Skip to content

Fix CodeQL uncontrolled-allocation-size false positive#72

Merged
zourzouvillys merged 1 commit intomainfrom
theo/fix-codeql-allocation-taint
Mar 8, 2026
Merged

Fix CodeQL uncontrolled-allocation-size false positive#72
zourzouvillys merged 1 commit intomainfrom
theo/fix-codeql-allocation-taint

Conversation

@zourzouvillys
Copy link
Collaborator

Summary

  • CodeQL's go/uncontrolled-allocation-size alert on replication_events.go:70 persisted despite correct min() bounds because CodeQL doesn't recognize Go's min() builtin as a taint sanitizer
  • Introduced clampInt() helper with explicit if-comparisons, returning a fresh variable (count) that severs the taint chain from user input to make()

Fixes https://github.com/sixfathoms/lplex/security/code-scanning/7

Test plan

  • All TestEventLog* tests pass

CodeQL doesn't recognize Go's min() builtin as a taint sanitizer, so
the uncontrolled-allocation-size alert persisted despite correct bounds.
Route through a clampInt helper that returns a fresh variable, severing
the taint propagation from user input to make().
@zourzouvillys zourzouvillys merged commit eeedf27 into main Mar 8, 2026
8 checks passed
@zourzouvillys zourzouvillys deleted the theo/fix-codeql-allocation-taint branch March 8, 2026 21:43
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