[PHP-CVS] Re: [PHP-DEV] Re: this causes a segfault cvs: php-src(PHP_4_3) /ext/pcre config.m4 php_pcre.c

2003-08-03 Thread Andrei Zmievski
On Thu, 10 Jul 2003, Jani Taskinen wrote:
 
 Fixed in CVS now. :)

What did you fix exactly and where? I don't see it.

-Andrei

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] Re: [PHP-DEV] Re: this causes a segfault cvs: php-src(PHP_4_3)/ext/pcre config.m4 php_pcre.c

2003-07-10 Thread Jani Taskinen

Fixed in CVS now. :)

--Jani


On Thu, 10 Jul 2003, Alan Knowles wrote:


 @@ -420,7 +421,32 @@
  size_offsets = num_subpats * 3;
  offsets = (int *)safe_emalloc(size_offsets, sizeof(int), 0);
  
 -/* Allocate match sets array and initialize the values */
 +/*
 + * Build a mapping from subpattern numbers to their names. We will always
 + * allocate the table, even though they may be no named subpatterns. This
 + * avoids somewhat more complicated logic in the inner loops.
 + */
 +subpat_names = (char **)safe_emalloc(num_subpats, sizeof(char *), 0);
 +memset(subpat_names, 0, sizeof(char *) * num_subpats);
 +{
 +int name_cnt, name_size, ni = 0;
 +char *name_table;
 +unsigned short name_idx;
 +
 +pcre_fullinfo(re, extra, PCRE_INFO_NAMECOUNT, name_cnt);
 +if (name_cnt  0) {
 +pcre_fullinfo(re, extra, PCRE_INFO_NAMETABLE, name_table);
 +pcre_fullinfo(re, extra, PCRE_INFO_NAMEENTRYSIZE, name_size);
 +
 +while (ni++  name_cnt) {
 +name_idx = 0xff * name_table[0] + name_table[1];
 +subpat_names[name_idx] = name_table + 2;

I'm getting name_idx = 23078, sizeof(subpat_names) = 4 here.

backing out the patch solves the problem

(sorry I've no idea what the code causing the problem is - it's part of 
  a huge app...)

Regards
Alan


 +name_table += name_size;
 +}
 +}
 +}
 +
 +/* Allocate match sets array and initialize the values. */
  if (global  subpats_order == PREG_PATTERN_ORDER) {
  match_sets = (zval **)safe_emalloc(num_subpats, sizeof(zval *), 0);
  for (i=0; inum_subpats; i++) {





-- 
https://www.paypal.com/xclick/[EMAIL PROTECTED]no_note=1tax=0currency_code=EUR
 


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php