Skip to content

fix(types): validate fixed type length#1404

Open
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/fixed-type-length-validation
Open

fix(types): validate fixed type length#1404
fallintoplace wants to merge 1 commit into
apache:mainfrom
fallintoplace:fix/fixed-type-length-validation

Conversation

@fallintoplace

@fallintoplace fallintoplace commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Why

fixed[N] schemas should only allow a positive fixed byte length, but the parser and constructor path currently allowed invalid lengths through. That could leak malformed type definitions into metadata and fail later in conversion/encoding paths.

What changed

  • Added strict fixed-length validation for both construction and parsing paths.
  • FixedTypeOf now rejects non-positive lengths.
  • Fixed-type parsing now validates the fixed(<length>) declaration using the same checks, so fixed[0] and invalid forms are rejected immediately.
  • Added regression coverage for malformed/invalid fixed type lengths.

Validation

  • go test . -run "TestFixedType|TestFixedTypeInvalidParse" -count=1
  • go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.11.4 run --timeout=10m

@fallintoplace fallintoplace requested a review from zeroshade as a code owner July 5, 2026 00:12
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