]> granicus.if.org Git - php/commitdiff
Fix #80002: calc free space for new interned string is wrong
authorChristoph M. Becker <cmbecker69@gmx.de>
Thu, 20 Aug 2020 09:20:03 +0000 (11:20 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 24 Aug 2020 09:03:19 +0000 (11:03 +0200)
We need to calculate the free size in bytes.

Patch contributed by t-matsuno.

Closes GH-6024

NEWS
ext/opcache/ZendAccelerator.c

diff --git a/NEWS b/NEWS
index 49ac4c5a6996649abb2878a5e7315f62e4f560d3..2dfd4e2fcb78f2578db62551d869be46ea2e7c53 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@ PHP                                                                        NEWS
   . Fixed bug #80007 (Potential type confusion in unixtojd() parameter parsing).
     (Andy Postnikov)
 
+- OPcache:
+  . Fixed bug #80002 (calc free space for new interned string is wrong).
+    (t-matsuno)
+
 03 Sep 2020, PHP 7.3.22
 
 - Core:
index 80f94eaf28f2ab894140009077de1ad8138f9e7a..dd4808bb17f70686c26d6de86eb12608f252bc22 100644 (file)
@@ -487,7 +487,7 @@ zend_string* ZEND_FASTCALL accel_new_interned_string(zend_string *str)
                } while (pos != STRTAB_INVALID_POS);
        }
 
-       if (UNEXPECTED(ZCSG(interned_strings).end - ZCSG(interned_strings).top < STRTAB_STR_SIZE(str))) {
+       if (UNEXPECTED((char*)ZCSG(interned_strings).end - (char*)ZCSG(interned_strings).top < STRTAB_STR_SIZE(str))) {
            /* no memory, return the same non-interned string */
                zend_accel_error(ACCEL_LOG_WARNING, "Interned string buffer overflow");
                return str;