Skip to content

fix(arreflect): validate primitive conversion assignment overflow checks#903

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:pr/fix-arreflect-overflow
Open

fix(arreflect): validate primitive conversion assignment overflow checks#903
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:pr/fix-arreflect-overflow

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Prevent silent corruption in arreflect primitive conversions by validating numeric assignment bounds before setting through reflection.

Why this fix

setPrimitiveValue used SetInt/SetUint/SetFloat directly for Arrow numeric types. That allowed values outside the target Go type range to wrap/truncate, so bad data could pass through without errors until consumed by fast paths relying on value integrity.

Changes

  • Added explicit overflow checks with:
    • OverflowInt
    • OverflowUint
    • OverflowFloat
  • Return ErrTypeMismatch-wrapped errors on overflow.
  • Preserve existing valid conversion behavior.

Files

  • arrow/array/arreflect/reflect_arrow_to_go.go
  • arrow/array/arreflect/reflect_arrow_to_go_test.go

Validation

  • Added tests for overflow cases:
    • int64 -> int8
    • uint64 -> uint8
    • float64 -> float32

Bug details

  • Severity: 82/100
  • Ask product?: 0/100

@fallintoplace fallintoplace requested a review from zeroshade as a code owner July 4, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant