Re: [PHP-DEV] basename() memory access violation

2004-06-16 Thread Andi Gutmans
I don't think it's a good idea to access s[-1] even if the logic works. This should be fixed IMO. At 10:30 PM 6/14/2004 +0200, Christian Schneider wrote: Ilia Alshanetsky wrote: Do you have an example script that can be used to reproduce the supposed memory access violation? The function php_bas

Re: [PHP-DEV] basename() memory access violation

2004-06-14 Thread Stefan Esser
Hi, The function php_basename actually DOES access the char at s-1, i.e. one byte before the string it is passed. If you hand it a buffer gotten from malloc you get a valgrind hit. If I use emalloc this doesn't happen, I guess emalloc has some header stuff before the allocation. If for whatever

Re: [PHP-DEV] basename() memory access violation

2004-06-14 Thread Christian Schneider
Ilia Alshanetsky wrote: Do you have an example script that can be used to reproduce the supposed memory access violation? The function php_basename actually DOES access the char at s-1, i.e. one byte before the string it is passed. If you hand it a buffer gotten from malloc you get a valgrind hi

Re: [PHP-DEV] basename() memory access violation

2004-06-14 Thread Ilia Alshanetsky
Do you have an example script that can be used to reproduce the supposed memory access violation? Ilia On June 14, 2004 01:51 pm, Alexander Valyalkin wrote: > Here is patch for basename() function, which prevents possible > memory access violation: > > =cut= > --- string.cThu

[PHP-DEV] basename() memory access violation

2004-06-14 Thread Alexander Valyalkin
Here is patch for basename() function, which prevents possible memory access violation: =cut= --- string.cThu May 13 20:44:32 2004 +++ string_basename.c Mon Jun 14 20:43:33 2004 @@ -1079,9 +1079,9 @@ /* strip trailing slashes */ - while (*c == '/' +while (c >= s && *