Patch getrecord-delimiter-search-fix for Streams related Bug #63240
Patch version 2012-10-09 09:02 UTC
Return to Bug #63240 |
Download this patch
Patch Revisions:
Developer: datibbaw@php.net
*** main/streams/streams.c 2012-06-13 12:54:23.000000000 +0800
--- mystreams.c 2012-10-09 17:00:12.000000000 +0800
***************
*** 1017,1022 ****
--- 1017,1027 ----
return memchr(&stream->readbuf[stream->readpos + skiplen],
delim[0], seek_len - skiplen);
} else {
+ if (skiplen) {
+ /* left part of the delimiter may still remain in the buffer,
+ rewind up to <delim_len - 1>*/
+ skiplen -= MIN(skiplen, delim_len - 1);
+ }
return php_memnstr((char*)&stream->readbuf[stream->readpos + skiplen],
delim, delim_len,
(char*)&stream->readbuf[stream->readpos + seek_len]);
|