com php-src: Merge branch 'PHP-7.0': ext/intl/grapheme/grapheme _string.c

From: Date: Wed, 27 Apr 2016 10:30:34 +0000
Subject: com php-src: Merge branch 'PHP-7.0': ext/intl/grapheme/grapheme _string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-91869@lists.php.net to get a copy of this message
Commit: 1a154c7db5685361a14e4f2985a292f6cfc3a7bf Author: Anatol Belski <ab@php.net> Wed, 27 Apr 2016 12:30:34 +0200 Parents: e35e5b218779342ae5afd35f482677374701265a 4bc97db0b8558aa1bd41fba6e09ee5e2045430ee Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1a154c7db5685361a14e4f2985a292f6cfc3a7bf Log: Merge branch 'PHP-7.0' * PHP-7.0: fix merge Fix memory leak Fix bug #72099: xml_parse_into_struct segmentation fault 5.5.36 now Fix bug #72094 - Out of bounds heap read access in exif header processing Fix bug #72093: bcpowmod accepts negative scale and corrupts _one_ definition Fix bug #72061 - Out-of-bounds reads in zif_grapheme_stripos with negative offset Fix for bug #71912 (libgd: signedness vulnerability) Typo in NEWS Bugs: https://bugs.php.net/72099 https://bugs.php.net/72094 https://bugs.php.net/72093 https://bugs.php.net/72061 https://bugs.php.net/71912 Changed paths: MM ext/intl/grapheme/grapheme_string.c Diff: diff --cc ext/intl/grapheme/grapheme_string.c index 9fb4e35,5687e3e..0735a7e --- a/ext/intl/grapheme/grapheme_string..c +++ b/ext/intl/grapheme/grapheme_string.c @@@ -134,21 -135,20 +135,21 @@@ PHP_FUNCTION(grapheme_strpos RETURN_FALSE; } + if (offset >= 0) { + /* quick check to see if the string might be there + * I realize that 'offset' is 'grapheme count offset' but will work in spite of that + */ - found = php_memnstr(haystack + offset, needle, needle_len, haystack + haystack_len); ++ found = php_memnstr(haystack + noffset, needle, needle_len, haystack + haystack_len); - /* quick check to see if the string might be there - * I realize that 'offset' is 'grapheme count offset' but will work in spite of that - */ - found = php_memnstr(haystack + noffset, needle, needle_len, haystack + haystack_len); - - /* if it isn't there the we are done */ - if (!found) { - RETURN_FALSE; - } + /* if it isn't there the we are done */ + if (!found) { + RETURN_FALSE; + } - /* if it is there, and if the haystack is ascii, we are all done */ - if ( grapheme_ascii_check((unsigned char *)haystack, haystack_len) >= 0 ) { - RETURN_LONG(found - haystack); + /* if it is there, and if the haystack is ascii, we are all done */ + if ( grapheme_ascii_check((unsigned char *)haystack, haystack_len) >= 0 ) { + RETURN_LONG(found - haystack); + } } /* do utf16 part of the strpos */

« previous php.cvs (#91869) next »