Skip to content

Commit

Permalink
Fix #80002: calc free space for new interned string is wrong
Browse files Browse the repository at this point in the history
We need to calculate the free size in bytes.

Patch contributed by t-matsuno.

Closes GH-6024
  • Loading branch information
cmb69 committed Aug 24, 2020
1 parent b2a33ab commit fcd26ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/ZendAccelerator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit fcd26ff

Please sign in to comment.