[php-src] PR #25485: Fix iconv_mime_encode() overflowing on a negative line-length
| From: | lacatoire | Date: | Mon, 16 Nov 2026 13:41:53 +0000 |
| Subject: | [php-src] PR #25485: Fix iconv_mime_encode() overflowing on a negative line-length | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-40683@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/25485
Author: lacatoire
iconv_mime_encode() passed a negative "line-length" to a size_t parameter,
which ended in a fatal "Possible integer overflow in memory allocation" error.
Reject values below 1 with a warning and return false. A value of 0, which
already returned false, now gets the same warning.
To reproduce:
```php
<?php
$o = ["input-charset" => "UTF-8", "output-charset" =>
"UTF-8"];
iconv_mime_encode("S", "héllo", $o + ["line-length" => -1]);
```
Before: Fatal error: Possible integer overflow in memory allocation.
After: a warning and false.