Skip to content

fix: validate truncate widths in utility entrypoints#739

Merged
wgtmac merged 1 commit into
apache:mainfrom
fallintoplace:fix/truncate-width-validation
Jun 17, 2026
Merged

fix: validate truncate widths in utility entrypoints#739
wgtmac merged 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

@fallintoplace fallintoplace changed the title Validate truncate widths in utility entrypoints fix: validate truncate widths in utility entrypoints Jun 16, 2026
@fallintoplace fallintoplace force-pushed the fix/truncate-width-validation branch from 54a8064 to a943a2d Compare June 16, 2026 17:08
@wgtmac wgtmac merged commit a2bbf18 into apache:main Jun 17, 2026
20 checks passed
@wgtmac

wgtmac commented Jun 17, 2026

Copy link
Copy Markdown
Member

Thank you, @fallintoplace!

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.

2 participants