]> granicus.if.org Git - php/commitdiff
Fix mbstring regex variable types to correspond to Oniguruma
authorGeorge Peter Banyard <girgias@php.net>
Sat, 22 Feb 2020 01:16:38 +0000 (02:16 +0100)
committerGeorge Peter Banyard <girgias@php.net>
Wed, 26 Feb 2020 10:24:03 +0000 (11:24 +0100)
The beginning and ending of a Oniguruma Regex are stored in a OnigRegion (which is a typedef to the Oniguruma re_registers struct) as as int* therefore change the type from size_t to int

Closes GH-5196

ext/mbstring/php_mbregex.c

index 8de9d2d30203f8667b371a8c3bb2a3f05acc124a..ceda96398ea65120450654bb6da545cbb2993a61 100644 (file)
@@ -1390,7 +1390,9 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
        char *arg_pattern = NULL, *arg_options = NULL;
        size_t arg_pattern_len, arg_options_len;
        int err;
-       size_t n, i, pos, len, beg, end;
+       size_t n, i, pos, len;
+       /* Stored as int* in the OnigRegion struct */
+       int beg, end;
        OnigOptionType option;
        OnigUChar *str;
        OnigSyntaxType *syntax;
@@ -1585,7 +1587,9 @@ PHP_FUNCTION(mb_ereg_search_init)
    Get matched substring of the last time */
 PHP_FUNCTION(mb_ereg_search_getregs)
 {
-       size_t n, i, len, beg, end;
+       size_t n, i, len;
+       /* Stored as int* in the OnigRegion struct */
+       int beg, end;
        OnigUChar *str;
 
        if (zend_parse_parameters_none() == FAILURE) {