]> granicus.if.org Git - php/commit
Fix #77367: Negative size parameter in mb_split
authorChristoph M. Becker <cmbecker69@gmx.de>
Sat, 29 Dec 2018 13:17:23 +0000 (14:17 +0100)
committerStanislav Malyshev <stas@php.net>
Sun, 6 Jan 2019 20:24:15 +0000 (12:24 -0800)
commite617f03066ce81d26f56c06d6bd7787c7de08703
tree10e221149035ff96fcffe9e70a996dfaf01e3a5a
parente40027ef0f508be87b323f61532cea0104212b53
Fix #77367: Negative size parameter in mb_split

When adding the last element to the result value of `mb_split`, the
`chunk_pos` may point beyond the end of the string, in which case the
unsigned `n` would underflow.  Therefore, we check whether this is the
case in the first place, and only calculate `n` otherwise.  Since `n`
is no longer used outside the block, we move its declaration inside.
ext/mbstring/php_mbregex.c
ext/mbstring/tests/bug77367.phpt [new file with mode: 0644]