From 89ed74a3d767a4a9dfdfe20d7c954fbc36c5ab72 Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Thu, 6 Jun 2024 14:53:29 +0200 Subject: [PATCH] fixed a crash on mismatched filter/SI type --- secondary/secondary.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/secondary/secondary.cpp b/secondary/secondary.cpp index 9710bce6..882b5670 100644 --- a/secondary/secondary.cpp +++ b/secondary/secondary.cpp @@ -290,8 +290,10 @@ int64_t SecondaryIndex_c::GetValsRows ( std::vector * pIterat ReaderFactory_c tReaderFactory = { .m_tCol = tCol, .m_tSettings = m_tSettings, .m_tRsetInfo = tRsetInfo, .m_iFD = m_tReader.GetFD(), .m_uVersion = m_uVersion, .m_uBlockBaseOff = uBlockBaseOff, .m_uBlocksCount = uBlocksCount, .m_uValuesPerBlock = m_uValuesPerBlock, .m_uRowidsPerBlock = m_uRowidsPerBlock, .m_pBounds = pBounds, .m_iCutoff = iCutoff }; std::unique_ptr pBlockReader { tReaderFactory.CreateBlockReader() }; - pBlockReader->CreateBlocksIterator ( dBlocksIt, *pIterators ); + if ( !pBlockReader ) + return 0; + pBlockReader->CreateBlocksIterator ( dBlocksIt, *pIterators ); return iNumIterators; } @@ -309,6 +311,9 @@ uint32_t SecondaryIndex_c::CalcValsRows ( const Filter_t & tFilter ) const ReaderFactory_c tReaderFactory = { .m_tCol = tCol, .m_tSettings = m_tSettings, .m_iFD = m_tReader.GetFD(), .m_uVersion = m_uVersion, .m_uBlockBaseOff = uBlockBaseOff, .m_uBlocksCount = uBlocksCount, .m_uValuesPerBlock = m_uValuesPerBlock, .m_uRowidsPerBlock = m_uRowidsPerBlock }; std::unique_ptr pBlockReader { tReaderFactory.CreateBlockReader() }; + if ( !pBlockReader ) + return 0; + return pBlockReader->CalcValueCount(dBlocksIt); } @@ -378,6 +383,9 @@ int64_t SecondaryIndex_c::GetRangeRows ( std::vector * pItera ReaderFactory_c tReaderFactory = { .m_tCol = tCol, .m_tSettings = m_tSettings, .m_tRsetInfo = tRsetInfo, .m_iFD = m_tReader.GetFD(), .m_uVersion = m_uVersion, .m_uBlockBaseOff = uBlockBaseOff, .m_uBlocksCount = uBlocksCount, .m_uValuesPerBlock = m_uValuesPerBlock, .m_uRowidsPerBlock = m_uRowidsPerBlock, .m_pBounds = pBounds, .m_iCutoff = iCutoff }; std::unique_ptr pReader { tReaderFactory.CreateRangeReader() }; + if ( !pReader ) + return 0; + pReader->CreateBlocksIterator ( tPosIt, tFilter, *pIterators ); return iNumIterators; @@ -398,6 +406,9 @@ uint32_t SecondaryIndex_c::CalcRangeRows ( const Filter_t & tFilter ) const ReaderFactory_c tReaderFactory = { .m_tCol = tCol, .m_tSettings = m_tSettings, .m_iFD = m_tReader.GetFD(), .m_uVersion = m_uVersion, .m_uBlockBaseOff = uBlockBaseOff, .m_uBlocksCount = uBlocksCount, .m_uValuesPerBlock = m_uValuesPerBlock, .m_uRowidsPerBlock = m_uRowidsPerBlock }; std::unique_ptr pReader { tReaderFactory.CreateRangeReader() }; + if ( !pReader ) + return 0; + return pReader->CalcValueCount ( tPosIt, tFilter ); }