com php-src: Fix #60494: iconv_mime_decode does ignore special characters: NEWS ext/iconv/iconv.c ext/i conv/tests/bug60494.phpt

From: Date: Sat, 25 Aug 2018 15:40:39 +0000
Subject: com php-src: Fix #60494: iconv_mime_decode does ignore special characters: NEWS ext/iconv/iconv.c ext/i conv/tests/bug60494.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-102892@lists.php.net to get a copy of this message
Commit: e29c946c29afdb0bf89c5329fcf3038448d50e17 Author: Christoph M. Becker <cmbecker69@gmx.de> Sat, 25 Aug 2018 15:41:44 +0200 Parents: 8754d44167d95a381c9c60beeb26492f4176fe1c Branches: PHP-7.1 PHP-7..2 PHP-7.3 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e29c946c29afdb0bf89c5329fcf3038448d50e17 Log: Fix #60494: iconv_mime_decode does ignore special characters We must not ignore erroneous characters in mime headers, but rather let iconv_mime_decode() fail in this case, issuing the usual notice regarding illegal characters. Bugs: https://bugs.php.net/60494 Changed paths: M NEWS M ext/iconv/iconv.c A ext/iconv/tests/bug60494.phpt Diff: diff --git a/NEWS b/NEWS index 69087d1..08f0fae 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ PHP NEWS - iconv: . Fixed bug #63839 (iconv_mime_decode_headers function is skipping headers). (cmb) + . Fixed bug #60494 (iconv_mime_decode does ignore special characters). (cmb) . Fixed bug #55146 (iconv_mime_decode_headers() skips some headers).. (cmb) - intl: diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index dd56eba..d759596 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -1544,7 +1544,10 @@ static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *st break; default: /* first letter of a non-encoded word */ - _php_iconv_appendc(pretval, *p1, cd_pl); + err = _php_iconv_appendc(pretval, *p1, cd_pl); + if (err != PHP_ICONV_ERR_SUCCESS) { + goto out; + } encoded_word = NULL; if ((mode & PHP_ICONV_MIME_DECODE_STRICT)) { scan_stat = 12; diff --git a/ext/iconv/tests/bug60494.phpt b/ext/iconv/tests/bug60494.phpt new file mode 100644 index 0000000..5c658af --- /dev/null +++ b/ext/iconv/tests/bug60494.phpt @@ -0,0 +1,23 @@ +--TEST-- +Bug #60494 (iconv_mime_decode does ignore special characters) +--SKIPIF-- +<?php +if (!extension_loaded('iconv')) die('skip iconv extension not available'); +?> +--FILE-- +<?php +var_dump(iconv_mime_decode('ä')); +var_dump(iconv_mime_decode('ö')); +var_dump(iconv_mime_decode('ß')); +?> +===DONE=== +--EXPECTF-- +Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d +bool(false) + +Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d +bool(false) + +Notice: iconv_mime_decode(): Detected an illegal character in input string in %s on line %d +bool(false) +===DONE===

« previous php.cvs (#102892) next »