]> granicus.if.org Git - php/commitdiff
Fixed bug #71876
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 3 Jan 2020 10:14:45 +0000 (11:14 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 17 Jan 2020 08:47:31 +0000 (09:47 +0100)
This is a backport of fcdc0a6db0ae63fbed9e3828137b899b844623ce
to the PHP-7.3 branch. We need to make sure that OnUpdateString
is also called for a NULL value, otherwise the reset of the encoding
at the end of the request will not work.

I believe I already tried to land this before once, but it didn't
actually end up on the PHP-7.3 branch due to a push conflict that
I only noticed just now.

NEWS
main/main.c

diff --git a/NEWS b/NEWS
index 8f20e992111de8e9055b3bf2202771a1bc7bf37c..e9693709490b998c407577a1641ed801bfe11e8f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? ????, PHP 7.3.15
 
+- Core:
+  . Fixed bug #71876 (Memory corruption htmlspecialchars(): charset `*' not
+    supported). (Nikita)
+
 - CURL:
   . Fixed bug #79078 (Hypothetical use-after-free in curl_multi_add_handle()).
     (cmb)
index 6917fe32309537d7471b2fb66285cece8a9de4ad..30629117d91a65f7622df3176f05c261ee34623a 100644 (file)
@@ -588,8 +588,8 @@ static PHP_INI_DISP(display_errors_mode)
  */
 static PHP_INI_MH(OnUpdateDefaultCharset)
 {
+       OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
        if (new_value) {
-               OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
 #ifdef PHP_WIN32
                php_win32_cp_do_update(ZSTR_VAL(new_value));
 #endif
@@ -602,8 +602,8 @@ static PHP_INI_MH(OnUpdateDefaultCharset)
  */
 static PHP_INI_MH(OnUpdateInternalEncoding)
 {
+       OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
        if (new_value) {
-               OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
 #ifdef PHP_WIN32
                php_win32_cp_do_update(ZSTR_VAL(new_value));
 #endif
@@ -616,8 +616,8 @@ static PHP_INI_MH(OnUpdateInternalEncoding)
  */
 static PHP_INI_MH(OnUpdateInputEncoding)
 {
+       OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
        if (new_value) {
-               OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
 #ifdef PHP_WIN32
                php_win32_cp_do_update(NULL);
 #endif
@@ -630,8 +630,8 @@ static PHP_INI_MH(OnUpdateInputEncoding)
  */
 static PHP_INI_MH(OnUpdateOutputEncoding)
 {
+       OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
        if (new_value) {
-               OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
 #ifdef PHP_WIN32
                php_win32_cp_do_update(NULL);
 #endif