Fix svace patch, fix e2k build

This commit is contained in:
survolog (Andrey Grigorev) 2023-10-05 21:23:08 +03:00
parent fd306e5848
commit 627ce7facb
3 changed files with 58 additions and 6 deletions

12
fix-include-e2k.patch Normal file
View file

@ -0,0 +1,12 @@
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c
index 53efa865..d6975a44 100644
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@ -24,6 +24,7 @@
#include "zend_accelerator_util_funcs.h"
#include "zend_persist.h"
#include "zend_shared_alloc.h"
+#include <immintrin.h>
#if SIZEOF_SIZE_T <= SIZEOF_ZEND_LONG
/* If sizeof(void*) == sizeof(zend_ulong) we can use zend_hash index functions */

View file

@ -43,10 +43,43 @@ diff -ur php-7.4.30/ext/phar/phar.c php-7.4.30_patched/ext/phar/phar.c
}
Pointer 'temp', that can have only NULL value (checked at
phar_object.c:3488), is dereferenced at phar_object.c:3488.
https://github.com/php/php-src/commit/7b2c3c11b2c9121421a81e416e893ce6114369d1
diff -ur php-7.4.30/ext/phar/phar_object.c php-7.4.30_patched/ext/phar/phar_object.c
--- php-7.4.30/ext/phar/phar_object.c 2022-06-07 11:38:23.000000000 +0300
+++ php-7.4.30_patched/ext/phar/phar_object.c 2023-10-05 15:50:52.253691230 +0300
@@ -3484,10 +3484,9 @@
+++ php-7.4.30_patched/ext/phar/phar_object.c 2023-10-05 20:30:46.577499264 +0300
@@ -2654,16 +2654,14 @@
zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname);
return;
}
- if (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint32_t) fname_len)) {
- if (NULL != (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint32_t) fname_len))) {
- if (entry->is_deleted) {
- /* entry is deleted, but has not been flushed to disk yet */
- RETURN_TRUE;
- } else {
- entry->is_deleted = 1;
- entry->is_modified = 1;
- phar_obj->archive->is_modified = 1;
- }
+ if (NULL != (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint32_t) fname_len))) {
+ if (entry->is_deleted) {
+ /* entry is deleted, but has not been flushed to disk yet */
+ RETURN_TRUE;
+ } else {
+ entry->is_deleted = 1;
+ entry->is_modified = 1;
+ phar_obj->archive->is_modified = 1;
}
} else {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s does not exist and cannot be deleted", fname);
@@ -3478,18 +3476,16 @@
RETURN_FALSE;
}
- if (!zend_hash_str_exists(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len) || NULL == (oldentry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len)) || oldentry->is_deleted) {
+ if (NULL == (oldentry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len)) || oldentry->is_deleted) {
zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
"file \"%s\" cannot be copied to file \"%s\", file does not exist in %s", oldfile, newfile, phar_obj->archive->fname);
RETURN_FALSE;
}
@ -54,12 +87,15 @@ diff -ur php-7.4.30/ext/phar/phar_object.c php-7.4.30_patched/ext/phar/phar_obje
- if (NULL != (temp = zend_hash_str_find_ptr(&phar_obj->archive->manifest, newfile, (uint32_t) newfile_len)) || !temp->is_deleted) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
- "file \"%s\" cannot be copied to file \"%s\", file must not already exist in phar %s", oldfile, newfile, phar_obj->archive->fname);
+ if (!zend_hash_str_exists(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len) || NULL == (oldentry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, oldfile, (uint32_t) oldfile_len)) || oldentry->is_deleted) {
- RETURN_FALSE;
- }
+ if (NULL != (temp = zend_hash_str_find_ptr(&phar_obj->archive->manifest, newfile, (uint32_t) newfile_len)) && !temp->is_deleted) {
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0,
+ "file \"%s\" cannot be copied to file \"%s\", file does not exist in %s", oldfile, newfile, phar_obj->archive->fname);
RETURN_FALSE;
}
+ "file \"%s\" cannot be copied to file \"%s\", file must not already exist in phar %s", oldfile, newfile, phar_obj->archive->fname);
+ RETURN_FALSE;
}
tmp_len = newfile_len;
After having been compared to a NULL value at tar.c:888,
pointer 'buf->s' is dereferenced at tar.c:902.
diff -ur php-7.4.30/ext/phar/tar.c php-7.4.30_patched/ext/phar/tar.c

View file

@ -90,6 +90,7 @@ Patch125: 0061-Fix-81727-Don-t-mangle-HTTP-variable-names-that-clas.patch
Patch126: 0062-Fix-bug-81738-buffer-overflow-in-hash_update-on-long.patch
# Svace 11.05.23
Patch127: php-7.4.30-svace.patch
Patch200: fix-include-e2k.patch
BuildRequires: autoconf
BuildRequires: automake
@ -1286,6 +1287,9 @@ fi
%patch125 -p1
%patch126 -p1
%patch127 -p1
%ifarch %{e2k}
%patch200 -p1
%endif
cp %{SOURCE2} maxlifetime
cp %{SOURCE3} php.crond