[php-src] PR #25963: Fix GH-25955: reject stream filter line lengths above UINT_MAX
| From: | jlu-lujing | Date: | Mon, 30 Nov 2026 17:21:24 +0000 |
| Subject: | [php-src] PR #25963: Fix GH-25955: reject stream filter line lengths above UINT_MAX | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-41271@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25963
Author: jlu-lujing
Fixes GH-25955.
php_conv_get_uint_prop_ex() reads line-length as a zend_ulong
and casts it to unsigned int, so values above UINT_MAX silently truncate.
For example, 2^32 + 76 aliases to 76 and produces a line break at the wrong position.
The converter option parser now rejects values above UINT_MAX with a
ValueError before the cast. Both base64 and quoted-printable encoders propagate this
failure and release the borrowed line-break string. The stream filter factory also avoids appending
a generic creation warning when the constructor already raised this ValueError, while
preserving warnings for other user-filter construction failures.
Validation:
- Added a PHPT test for both encoder filters, covering 2^32 and 2^32 + 76,
exception messages, and unchanged stream contents.
- make test TESTS=ext/standard/tests/filters: 58 passed, 5 skipped, 0 failed.
- git diff --check: passed.