Skip to content

Validate truncate widths in utility entrypoints#739

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/truncate-width-validation
Open

Validate truncate widths in utility entrypoints#739
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/truncate-width-validation

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Summary

  • Reject non-positive widths in the TruncateLiteral and TruncateLiteralMax utility entrypoints.
  • Reject zero width in TruncateUTF8Max, which returns a Result and can report invalid input directly.
  • Add regression coverage for zero and negative widths across numeric, decimal, string, and binary literal truncation.

Why

The truncate transform validates its width before creating a transform function, but the utility functions can also be called directly. Without a guard there, invalid widths can reach modulo operations or iterator arithmetic in the type-specific implementations.

Testing

  • cmake --build build --target util_test
  • ctest --test-dir build -R util_test --output-on-failure

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