CVE-2026-40890: Go Missing Bounds Check After Loop

An index is incremented in a bound-checking loop but is then used to slice beyond the bounds without checking if the slice was exhausted. This can lead to a panic (out-of-bounds read). Ensure that you check if the loop reached the maximum string length before slicing with `[:i+1]`.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0Go
greprules fetch cve-2026-40890-go-missing-bounds-check-after-loop --engine opengrep

Description

An index is incremented in a bound-checking loop but is then used to slice beyond the bounds without checking if the slice was exhausted. This can lead to a panic (out-of-bounds read). Ensure that you check if the loop reached the maximum string length before slicing with `[:i+1]`.