Skip to content
Permalink
Browse files

Fix defects in concat and group-concat

Concat had problem with off-by-one copying - when copying result to the
final string one extra byte over the end of the buffer was copied.
group-concat had problem with double-free of copied blob attributes
(that defect is fixed, however it seems that this codeflow better to
review again)
That fixes #881
  • Loading branch information...
klirichek committed May 30, 2019
1 parent d0dc1f0 commit f047222339fd0e62a07e9ca8b2a829297d5db861
Showing with 11 additions and 7 deletions.
  1. +4 −1 src/sphinxexpr.cpp
  2. +2 −2 src/sphinxsort.cpp
  3. +2 −2 test/test_253/model.bin
  4. +3 −2 test/test_253/test.xml
@@ -1113,7 +1113,10 @@ class Expr_ToString_c : public Expr_Unary_c
int iLen = m_pFirst->StringEval ( tMatch, ppStr );
dTmp.Resize(iLen+1);
if ( ppStr )
memcpy ( dTmp.Begin(), *ppStr, dTmp.GetLength() );
{
memcpy ( dTmp.Begin(), *ppStr, iLen );
dTmp[iLen] = '\0';
}
else
dTmp[0] = '\0';

@@ -1571,8 +1571,8 @@ struct MatchCloner_t
for ( auto &AttrsRaw : m_dAttrsRaw )
pDst->SetAttr ( AttrsRaw, pGroup->GetAttr ( AttrsRaw ) );

m_pSchema->FreeDataSpecial ( pDst, m_dMyPtrRows );
m_pSchema->CopyPtrsSpecial ( pDst, pGroup->m_pDynamic, m_dMyPtrRows );
// CSphSchemaHelper::FreeDataSpecial ( pDst, m_dMyPtrRows );
CSphSchemaHelper::CopyPtrsSpecial ( pDst, pGroup->m_pDynamic, m_dMyPtrRows );
}

void Clone ( CSphMatch * pDst, const CSphMatch * pSrc )

0 comments on commit f047222

Please sign in to comment.
You can’t perform that action at this time.