[php-src] PR #24442: Fix quoted_printable_encode() exceeding the line length for bytes 0xF5 to 0xFF
| From: | auraseb | Date: | Mon, 19 Oct 2026 15:32:58 +0000 |
| Subject: | [php-src] PR #24442: Fix quoted_printable_encode() exceeding the line length for bytes 0xF5 to 0xFF | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39602@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24442
Author: auraseb
php_quot_print_encode() decides whether to insert a soft line break based on the byte
being encoded. Bytes up to 0x7F and the UTF-8 lead and continuation bytes up to 0xF4 are covered,
but bytes 0xF5 to 0xFF match no branch, so they never cause a break. A run of such bytes (or binary
data that ends a line with one) produces lines longer than the 76 characters RFC 2045 allows:
```php
var_dump(strlen(quoted_printable_encode(str_repeat("\xFF", 30)))); // one 90 character
line
```
These bytes can not start a UTF-8 sequence, so this treats them like single bytes and breaks as soon
as the encoded byte no longer fits on the line.
The decoded output is unchanged; only the placement of soft line breaks differs. Added a test
covering 0xF5, 0xF8 and 0xFF.
Targets the lowest supported bugfix branch; the patch applies unchanged there.
Fixes #24441