Permalink
Browse files

fixed #1146 edge cases on reading sphinxql_state

git-svn-id: http://sphinxsearch.googlecode.com/svn/trunk@3178 8b96e2b9-35c5-2c16-bc47-5122d61876d4
  • Loading branch information...
1 parent b73cb80 commit c24fb8375e31167dcbfeb4ce46f516e744914499 tomat committed Apr 6, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/searchd.cpp
View
@@ -13908,6 +13908,7 @@ static void UservarsStateRead ( const CSphString & sName )
CSphVector<char> dLine;
dLine.Reserve ( iReadBlock + iGapLen );
+ bool bEscaped = false;
int iLines = 0;
for ( ;; )
{
@@ -13924,17 +13925,19 @@ static void UservarsStateRead ( const CSphString & sName )
while ( s<pEnd )
{
// goto next line for escaped string
- if ( *s=='\\' )
+ if ( *s=='\\' || ( bEscaped && ( *s=='\n' || *s=='\r' ) ) )
{
s++;
while ( s<pEnd && ( *s=='\n' || *s=='\r' ) )
{
iLines += ( *s=='\n' );
s++;
}
+ bEscaped = ( s>=pEnd );
continue;
}
+ bEscaped = false;
if ( *s=='\n' || *s=='\r' )
{
if ( !StateReaderAddUservar ( dLine, &sError ) )

0 comments on commit c24fb83

Please sign in to comment.