fix: bounds check in Delete to prevent index out of range panic#280
fix: bounds check in Delete to prevent index out of range panic#280Yanhu007 wants to merge 1 commit intobuger:masterfrom
Conversation
|
Hi @buger and @Yanhu007 — we hit the same panic in the TestifySec Platform supply-chain stack and ended up vendoring a fork of v1.1.1 with a Two things that may help land this: Adversarial test fixtures We built a regression suite for GHSA-6g7g-w4f8-9c9x while building our fork. Drops cleanly into
The PoC from #274 ( Bounds check coverage The check at the call site fixes the specific panic in the linked stack trace, but Tag a release after merge and we can drop our fork — there are 31 dependabot alerts in our org that this resolves. Thanks for the fix. |
Fixes #274
Problem
Deleteaccessesdata[endOffset+tokEnd]without checking if the index is within bounds.tokenEnd()returnslen(data)when no terminator is found, soendOffset+tokEndcan exceed the slice length, causing a panic:Found by fuzzing.
Fix
Add a bounds check before accessing
data[endOffset+tokEnd]:All existing tests pass.