File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -342,6 +342,7 @@ SMCError TextParsers::ParseStream_SMC(void *stream,
342
342
SMCResult res;
343
343
SMCStates states;
344
344
char c;
345
+ bool end_of_last_buffer_was_backslash = false ;
345
346
346
347
StringInfo strings[3 ];
347
348
StringInfo emptystring;
@@ -383,6 +384,10 @@ SMCError TextParsers::ParseStream_SMC(void *stream,
383
384
if (reparse_point)
384
385
{
385
386
read += (parse_point - reparse_point);
387
+ if (read > 0 )
388
+ {
389
+ end_of_last_buffer_was_backslash = reparse_point[-1 ] == ' \\ ' ;
390
+ }
386
391
parse_point = reparse_point;
387
392
reparse_point = NULL ;
388
393
}
@@ -454,7 +459,7 @@ SMCError TextParsers::ParseStream_SMC(void *stream,
454
459
if (in_quote)
455
460
{
456
461
/* If i was 0, we could have reparsed, so make sure there's no buffer underrun */
457
- if ((&parse_point[i] != in_buf) && c == ' "' && parse_point[i-1 ] != ' \\ ' )
462
+ if ( (&parse_point[i] != in_buf) && c == ' "' && !((i == 0 && end_of_last_buffer_was_backslash) || (i > 0 && parse_point[i-1 ] == ' \\ ' )) )
458
463
{
459
464
/* If we reached a quote in an ignore phase,
460
465
* we're staging a string and we must rotate it out.
@@ -726,6 +731,7 @@ SMCError TextParsers::ParseStream_SMC(void *stream,
726
731
if (parse_point)
727
732
{
728
733
parse_point = &parse_point[read];
734
+ end_of_last_buffer_was_backslash = parse_point[-1 ] == ' \\ ' ;
729
735
parse_point -= bytes;
730
736
}
731
737
}
You can’t perform that action at this time.
0 commit comments