Skip to content

GH-1098: [Java][Vector] Fix always-true precondition check in LargeListVector.setValueCount#1099

Open
LuciferYang wants to merge 1 commit intoapache:mainfrom
LuciferYang:fix-large-list-vector-precondition-logic
Open

GH-1098: [Java][Vector] Fix always-true precondition check in LargeListVector.setValueCount#1099
LuciferYang wants to merge 1 commit intoapache:mainfrom
LuciferYang:fix-large-list-vector-precondition-logic

Conversation

@LuciferYang
Copy link
Copy Markdown

What's Changed

Fix the precondition check in LargeListVector.setValueCount() where || made the condition always true (childValueCount <= Integer.MAX_VALUE || childValueCount >= Integer.MIN_VALUE is a tautology for any long value), allowing silent data corruption when childValueCount exceeds Integer.MAX_VALUE or is negative.

Changes:

  • Replace || with && and Integer.MIN_VALUE with 0 to correctly bound childValueCount to [0, Integer.MAX_VALUE], consistent with LargeListViewVector
  • Add rejection tests for negative and overflow childValueCount
  • Add positive boundary tests for zero, valid, and Integer.MAX_VALUE values

Closes #1098.

@github-actions

This comment has been minimized.

@LuciferYang
Copy link
Copy Markdown
Author

Could a maintainer please add the bug-fix label to this PR? I don't have label permissions on this repository. Thank you!

@lidavidm lidavidm added the bug-fix PRs that fix a big. label Mar 30, 2026
@github-actions github-actions bot added this to the 20.0.0 milestone Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PRs that fix a big.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java][Vector] Always-true precondition check in LargeListVector.setValueCount allows silent data corruption

2 participants