提交 b3faef51 编写于 作者: A Alex Duan

fixed if condition crash when pos == -1

上级 96442834
...@@ -1641,10 +1641,13 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo* ...@@ -1641,10 +1641,13 @@ static void doMergeTwoLevelData(STsdbQueryHandle* pQueryHandle, STableCheckInfo*
break; break;
} }
// above condition same with key in file // break if pos not in this block endPos range. note old code when pos is -1 can crash.
if (((pos > endPos || keyFile[pos] > pQueryHandle->window.ekey) && ASCENDING_TRAVERSE(pQueryHandle->order)) || if(ASCENDING_TRAVERSE(pQueryHandle->order)) { //ASC
((pos < endPos || keyFile[pos] < pQueryHandle->window.ekey) && !ASCENDING_TRAVERSE(pQueryHandle->order))) { if(pos > endPos || keyFile[pos] > pQueryHandle->window.ekey)
break; break;
} else { //DESC
if(pos < endPos || keyFile[pos] < pQueryHandle->window.ekey)
break;
} }
// put keyMem row // put keyMem row
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册