Commit graph

61766 commits

Author SHA1 Message Date
Jakub Zelenka
11f2568767
Fix bug GHSA-q6x7-frmf-grcw: password_verify can erroneously return true
Disallow null character in bcrypt password
2024-04-10 00:02:11 -05:00
Niels Dossche
b756b5a461
Fix GHSA-wpj3-hf5j-x4v4: __Host-/__Secure- cookie bypass due to partial CVE-2022-31629 fix
The check happened too early as later code paths may perform more
mangling rules. Move the check downwards right before adding the actual
variable.
2024-04-10 00:02:11 -05:00
Jakub Zelenka
7ad6ff7d5c
Add proc_open escaping for cmd file execution 2024-04-10 00:02:11 -05:00
ddv
3f57bd80f6 Fix phpGH-12763: PGSQL pg_untrace(): Argument #1 ($connection) must be of type resource or null, PgSql\Connection given. 2023-11-27 18:18:46 +00:00
Mikhail Galanin
7e7817bc2f Avoid using uninitialised struct
Closes GH-12046.
2023-11-25 20:07:14 +01:00
Bob Weinand
d404e1d1ee USE_ZEND_ALLOC=1 in tests with zend_test.observe_opline_in_zendmm=1 2023-11-25 18:44:45 +01:00
Florian Engelhardt
8d2df86b06
Fix invalid opline in OOM handlers within ZEND_FUNC_GET_ARGS and ZEND_BIND_STATIC (#12768)
* fix segfault in `ZEND_BIND_STATIC`

In case a `ZEND_BIND_STATIC` is being executed, while the current chunk is full,
the `zend_array_dup()` call will trigger a OOM in ZendMM which will crash, as
the opline might be a dangling pointer.

* add missing test

* `assert()`ing seems easier than trying to make the compiler to not optimize

* moved from function call to INI setting, so we can use this in other places as well

* make `assert()` work no NDEBUG builds

* document magic number

* fix segfault in `ZEND_FUNC_GET_ARGS`

In case a `ZEND_FUNC_GET_ARGS` is being executed, while the current chunk is
full, the `zend_new_array()` call will trigger a OOM in ZendMM which will crash,
as the opline might be a dangling pointer.

---------

Co-authored-by: Florian Engelhardt <florian@engelhardt.tc>
2023-11-25 00:54:02 +01:00
Dmitry Stogov
87107f8688
Fixed GH-12748: Function JIT emits "could not convert to int" warning at the same time as invalid offset Error 2023-11-22 21:11:49 -06:00
Muhammad Moinur Rahman
fafa34d9cd
Add host_cpu type for FreeBSD
In FreeBSD world x86_64 host type is identified as amd64 so add proper
checks for FreeBSD amd64 hosts.

Close GH-12736
2023-11-22 21:10:52 -06:00
Jakub Zelenka
55e0748487
Fix #50713: openssl_pkcs7_verify() may ignore untrusted CAs
Closes GH-12499
2023-11-22 21:03:55 -06:00
Ben Ramsey
2b4a47ccec
Merge changes to CertificateGenerator.inc from PHP-8.2
This pulls only the changes made to CertificateGenerator.inc in the PHP-8.2
branch from commit 505e8d2a04.

Co-authored-by: Jakub Zelenka <bukka@php.net>
2023-11-22 20:39:30 -06:00
Niels Dossche
243fa9c143
Fix GH-12616: DOM: Removing XMLNS namespace node results in invalid default: prefix
The namespace data is freed and set to NULL, but there remain references
to the namespace declaration nodes. This (rightfully) confuses libxml2
because its invariants are broken. We also have to remove all remaining
references from the subtree. This fixes the data corruption bug.

Closes GH-12681.
2023-11-22 20:39:30 -06:00
Niels Dossche
6a76e5d0a2
Fix GH-12702: libxml2 2.12.0 issue building from src
Fixes GH-12702.

Co-authored-by: nono303 <github@nono303.net>
2023-11-22 20:39:30 -06:00
Jakub Zelenka
a7a6151c4f
Fix bug #79945: Stream wrappers in imagecreatefrompng causes segfault
Closes GH-12696
2023-11-22 20:39:30 -06:00
Ilija Tovilo
0b754fc48c
Temporarily disable failing zlib tests on travis (#10738) 2023-11-22 20:39:30 -06:00
Ilija Tovilo
05ba461524
[skip ci] Fix more test tmp file conflicts 2023-11-22 20:39:29 -06:00
Ilija Tovilo
e1e140f2f2
Fix file test race condition
005_variation2.phpt creates files with special names, and
filesize_variation5.phpt checks for filesize of inexistent files with special
names. Create the files in a separate directory to avoid these tests clashing.

Closes GH-12692
2023-11-22 20:39:29 -06:00
Niels Dossche
4f5ba054ba
Use __DIR__-relative path in tests
Otherwise we can't run them from another directory, they'll fail
instead.
2023-11-22 20:39:29 -06:00
Ilija Tovilo
28c312c994
[skip ci] Further increase allowable atime deviation
MSAN is slow in particular, leading to potentially higher deviations.
2023-11-22 20:39:29 -06:00
Niels Dossche
c376f9943f
Fix GH-12655: proc_open() does not take into account references in the descriptor array
Closes GH-12658.
2023-11-22 20:39:28 -06:00
Ilija Tovilo
fe34dd1b49
Fix astat imperciseness excemption in test 2023-11-22 20:39:28 -06:00
Ilija Tovilo
db8c91ae9f
Fix undeclared variable in stat tests
Closes GH-12645
2023-11-22 20:39:28 -06:00
Niels Dossche
e1c6a7c4de
Fix GH-12621: browscap segmentation fault when configured in the vhost
The temporary HashTable has a destructor that releases the string held
by the entry's value. However, browscap_intern_str(_ci) only incremented
the refcount for the reference created by the return value. As the
HashTable is only used during parsing, we don't need to manage the
reference count of the value anyway, so get rid of the destructor.

This is triggerable in two cases:
 - When using php_admin_value to set the ini at the activation stage
 - When running out of space for the opcache-interned strings

Closes GH-12634.
2023-11-22 20:39:28 -06:00
Niels Dossche
6641cd159e
Fix GH-12635: Test bug69398.phpt fails with ICU 74.1
ICU 74.1 contains new locale data that breaks the test.
Split the test based on the version number to resolve the issue.

Closes GH-12653.
2023-11-22 20:39:27 -06:00
Jakub Zelenka
b4208c8f96
Initialize syslog device in GINIT
Closes GH-12663
2023-11-16 14:31:44 +00:00
Remi Collet
6625226074
fix GH-12661 (Inconsistency in ZipArchive::addGlob remove_path Option Behavior) 2023-11-14 14:54:20 +01:00
Dmitry Stogov
c60c2a0d67
Backport fix for GH-12512: JIT Assertion `info & (1 << type)' failed (#12660) 2023-11-13 13:26:17 +03:00
SakiTakamachi
6a43135c1d
Fix timezone dependent test
Closes GH-12637
2023-11-10 12:10:30 +01:00
SakiTakamachi
2a4775d6a7 Fix GH-12633: sqlite3_defensive.phpt fails with sqlite 3.44.0
Removes 'PRAGMA writable_schema;'.

From sqlite changelog https://www.sqlite.org/releaselog/3_44_0.html:
> The SQLITE_DBCONFIG_DEFENSIVE setting now prevents PRAGMA writable_schema
> from being turned on.
> Previously writable_schema could be turned on, but would not actually allow
> the schema to be writable. Now it simply cannot be turned on.

Closes GH-12636.
2023-11-10 00:03:33 +01:00
Niels Dossche
78fba9cb80 Fix GH-12628: The gh11374 test fails on Alpinelinux
Closes GH-12636.
2023-11-10 00:01:22 +01:00
Daniil Gentili
10b2b4a52c
Fix memory leak in standard syslog device handling
The BG(syslog_device) is leaked in RINIT.

Closes GH-12501
2023-11-09 13:29:09 +00:00
Jakub Zelenka
a8c6c6165b
Fix GH-9921: Loading ext in FPM config does not register module handlers
Closes GH-12377
2023-11-03 16:53:09 +00:00
Niels Dossche
20c9c4a367 Fix validation logic of php:function() callbacks in dom and xsl
Two issues:
- Assumed that at least 1 argument (function name) was provided.
- Incorrect error path for the non-callable case.

Closes GH-12593.
2023-11-02 20:28:55 +01:00
Dmitry Stogov
77a497d56a Don't JIT after fatal errors 2023-11-02 14:14:12 +03:00
Dmitry Stogov
798b9d097b Fixed GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT 2023-11-02 08:09:29 +03:00
David Carlier
0da1356c66 ext/intl: change when the locale is invalid for the 8.1/8.2 serie.
does not throws an exception as it's considered as a too string change,
but the code user still needs to double check.
2023-11-01 19:12:50 +00:00
Dmitry Stogov
19dfe05f16 Fixed inorrect QM_ASSIGN elimination
Fixes oss-fuzz #63771
2023-11-01 09:54:58 +03:00
Dmitry Stogov
455a967934 Backport fix for incorrect assumption about in-memory zval type 2023-10-31 11:56:01 +03:00
Dmitry Stogov
b3b46a44c5 Fixed GH-12511: Use must be in next opline assertion with patched infection 2023-10-31 07:51:36 +03:00
sji
04b35a44ce
Fix segfault caused by weak references to FFI objects (#12488)
Thank you!
2023-10-28 14:59:06 +02:00
Michael Voříšek
83a505e85f Fix GH-11374: Different preg_match result with -d pcre.jit=0
This is a backport of https://github.com/PCRE2Project/pcre2/pull/300.

Closes GH-12439.
2023-10-27 17:43:33 +02:00
Dmitry Stogov
5f46d86955 Fixed GH-12509: JIT assertion when running php-parser tests 2023-10-26 23:58:29 +03:00
Niels Dossche
27797a26ca Fix bug #75306: Memleak in SoapClient
Setting the stream context via php_stream_context_to_zval() will
increase the reference count. So if the new context is created, then it
will end up with a reference count of 2 while it should be 1.

Credits to cmb for the analysis. I arrived at the same patch as he did.

Closes GH-12523.
2023-10-26 19:58:31 +02:00
Niels Dossche
9f7f3b2034 Fix incorrect dtor for persistent sdl->encoders
Closes GH-12515.
2023-10-25 17:53:42 +02:00
Dmitry Stogov
fbf4e196da Fixed regression intoduced by 76c41d27f9 2023-10-25 15:15:13 +03:00
icy17
900f0cab9f Fix null pointer dereferences in case of allocation failure
Closes GH-12506.
2023-10-24 19:34:47 +02:00
Dmitry Stogov
aa45df4849 Fixed incorrect type inference 2023-10-24 18:48:29 +03:00
Dmitry Stogov
76c41d27f9 Fixed GH-12482: Abortion with tracing JIT 2023-10-24 14:20:35 +03:00
Dmitry Stogov
e270ee3008 memory_consumption must be page aligned 2023-10-23 12:10:11 +03:00
Dmitry Stogov
e0ca4dca5b Fixed GH-12494: Zend/tests/arginfo_zpp_mismatch.phpt causes a segfault withJIT + --repeat 2 2023-10-23 10:50:55 +03:00