Skip to content

Commit

Permalink
fixed #513 crash or hung of daemon on empty SNIPPET expression; added…
Browse files Browse the repository at this point in the history
… regressions to test 168
  • Loading branch information
tomatolog committed Sep 20, 2018
1 parent b36d792 commit ad3710d
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/searchd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6287,7 +6287,7 @@ struct Expr_Snippet_c : public ISphStringExpr
int iResultLength = m_tHighlight.m_dRes.GetLength();
*ppStr = m_tHighlight.m_dRes.LeakData();
// skip trailing zero
return iResultLength-1;
return ( iResultLength ? iResultLength-1 : 0 );
} else
return PackSnippets ( m_tHighlight.m_dRes, m_tHighlight.m_dSeparators, m_tHighlight.m_sChunkSeparator.Length(), ppStr );
}
Expand Down
Loading

0 comments on commit ad3710d

Please sign in to comment.