#53896·milvus

[Bug]: [2.6] integer-overflow fast path returns mismatched result/validity bitmaps after a conjunct skip

Author: czs007Created Sep 28, 2026Updated Sep 28, 2026
Labelskind/bug

Is there an existing issue for this?

  • I have searched the existing issues

Environment

  • Milvus version: 2.6 branch (reproduced on ec77bc31e / hotfix-2.6.23 and current 2.6 HEAD)
  • Deployment mode: any (segcore expression layer)

Current Behavior

PhyUnaryRangeFilterExpr::PreCheckOverflow and PhyBinaryRangeFilterExpr::PreCheckOverflow (the fast path taken when an integer field is compared with a literal outside the field type's range) size the result bitmap from a private cursor overflow_check_pos_, while the validity bitmap comes from the data/index cursor through ProcessChunksForValid.

MoveCursor() only advances the data/index cursors. After a conjunct short-circuits and skips the predicate for a batch (SkipFollowingExprs -> MoveCursor()), the two cursors drift apart and the fast path returns a ColumnVector whose result bitmap and validity bitmap have different lengths (e.g. 8192 vs 100 on the last batch).

ThreeValuedLogicOp::And/Or, PhyConjunctFilterExpr::UpdateResult / SetNextExprBitmapInput and PhyFilterBitsNode build validity views from the result length, so they read and write past the end of the validity bitmap (heap buffer overflow), and the filter result is wrong.

Expected Behavior

Result and validity bitmaps returned by the overflow fast path always cover the same rows.

Steps To Reproduce

  1. Collection with a nullable INT8 field age and an INT64 field k (values 0..N-1), N not a multiple of 8192 (e.g. 3 * 8192 + 100).
  2. Filter: k >= 8192 and (age < 1000 or k < 0). The first batch is all FALSE on the left, so the outer AND skips the inner OR; 1000 does not fit INT8, so age < 1000 takes the overflow fast path.
  3. With a size check on ColumnVector(bitmap, valid) the last batch shows an 8192-row result with a 100-row validity bitmap; without it, the downstream three-valued merge accesses memory past the validity bitmap.

Anything else?

master fixed this as part of #51725 (3.0: #51940) by sizing the batch from the validity bitmap and removing overflow_check_pos_. That change did not reach 2.6.