summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-08-20 11:20:03 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2020-08-24 11:03:19 +0200
commitfcd26ffcc3f3a1ce5e5bd78afd89c484e206e3ea (patch)
tree8a30056aaab76037a77d8fa217665ec2b9777f67
parentb2a33ab06bab4f2d79634e294632bebebd04acdb (diff)
downloadphp-git-fcd26ffcc3f3a1ce5e5bd78afd89c484e206e3ea.tar.gz
Fix #80002: calc free space for new interned string is wrong
We need to calculate the free size in bytes. Patch contributed by t-matsuno. Closes GH-6024
-rw-r--r--NEWS4
-rw-r--r--ext/opcache/ZendAccelerator.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 49ac4c5a69..2dfd4e2fcb 100644
--- 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:
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 80f94eaf28..dd4808bb17 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -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;