summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2018-08-25 17:49:39 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2018-08-25 17:52:16 +0200
commitb5afc99afb3374e1f1c76542ba188c8d38de3a81 (patch)
tree930f043229ff9e25ec02fe10a8abf9c96e6cf418
parent065eee16b51635bbc2b5fe10965cad6fd24ef9fd (diff)
parent314b8ecf8b07a8b87efeca5454e36a6b55ca4dd1 (diff)
downloadphp-git-b5afc99afb3374e1f1c76542ba188c8d38de3a81.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #60494: iconv_mime_decode does ignore special characters
-rw-r--r--NEWS1
-rw-r--r--ext/iconv/iconv.c5
-rw-r--r--ext/iconv/tests/bug60494.phpt23
3 files changed, 28 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index b055777bb3..c73d79e5b9 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,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)
. Fixed bug #53891 (iconv_mime_encode() fails to Q-encode UTF-8 string). (cmb)
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 70929e0563..43c2798122 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -1534,7 +1534,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 0000000000..5c658af56b
--- /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===