[php-src] master: Merge branch 'PHP-8.6'
| From: | Daniel Scherzer | Date: | Tue, 29 Sep 2026 00:36:38 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141664@lists.php.net to get a copy of this message | ||
Author: Daniel Scherzer (DanielEScherzer)
Date: 2026-09-28T17:36:09-07:00
Commit: https://github.com/php/php-src/commit/810ac6dc4d2bb5b74f0a9ba478f4b9202f68cb10
Raw diff: https://github.com/php/php-src/commit/810ac6dc4d2bb5b74f0a9ba478f4b9202f68cb10.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
ext/iconv: add a hardening assertion that
char_cnt doesn't underflow (#23873)
Changed paths:
M ext/iconv/iconv.c
Diff:
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index af4717a00a48..dad797ee14b4 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -1102,6 +1102,12 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char
*fn
const unsigned char *p;
size_t nbytes_required;
+ /* Some agents get confused about what char_cnt is; it will
+ * be at least 4 at this point; if caller messed up and gave
+ * too short of a max_line_len that was already caught above
+ * and handled with PHP_ICONV_ERR_TOO_BIG. */
+ ZEND_ASSERT(char_cnt >= 4);
+
smart_str_appendc(pretval, 'Q');
char_cnt--;
smart_str_appendc(pretval, '?');