Skip to content

fix: add bounds checks for hard-coded slice index access#644

Merged
harp-intel merged 1 commit intomainfrom
fix/bounds-check-slice-access
Feb 19, 2026
Merged

fix: add bounds checks for hard-coded slice index access#644
harp-intel merged 1 commit intomainfrom
fix/bounds-check-slice-access

Conversation

@harp-intel
Copy link
Contributor

Summary

  • Add early-return guards and per-iteration bounds checks to prevent index-out-of-range panics when renderer and print functions receive empty or undersized slice data
  • Guards cover missing field length checks (e.g., Fields[0], Fields[1:], Fields[2:]) and cross-index mismatches where one field's values index into a shorter field
  • All guards log an slog.Error with table name and field count context before returning

Test plan

  • make check passes (gofmt, go vet, staticcheck, golangci-lint, govulncheck, unit tests)
  • make test passes with no regressions

🤖 Generated with Claude Code

Prevent index-out-of-range panics when functions receive empty or
undersized data by adding early-return guards and per-iteration bounds
checks to renderer and print functions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@harp-intel harp-intel merged commit 78c3dbf into main Feb 19, 2026
5 checks passed
@harp-intel harp-intel deleted the fix/bounds-check-slice-access branch February 19, 2026 18:20
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

Comments