]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.0'
authorAnatol Belski <ab@php.net>
Wed, 27 Apr 2016 10:30:34 +0000 (12:30 +0200)
committerAnatol Belski <ab@php.net>
Wed, 27 Apr 2016 10:30:34 +0000 (12:30 +0200)
* 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

1  2 
ext/intl/grapheme/grapheme_string.c

index 9fb4e3540501ce206e9058939d25f32d38a9821e,5687e3e260719e31b7edf7517922f7264f4b8fa5..0735a7e82263fced935d9c7115183b159959b127
@@@ -134,21 -135,20 +135,21 @@@ PHP_FUNCTION(grapheme_strpos
                RETURN_FALSE;
        }
  
-               found = php_memnstr(haystack + offset, needle, needle_len, haystack + haystack_len);
 +      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 + 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 */