mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-06 07:38:24 +00:00
fix: double check inputIndex in base64.decode (#25531)
fixes https://github.com/nim-lang/Nim/issues/25530
this double checks the index to make sure whitespace related index
increments cannot cause index defect error
(cherry picked from commit 86b9245dd6)
This commit is contained in:
committed by
narimiran
parent
5ec6391124
commit
45f1b92b72
@@ -253,6 +253,9 @@ proc decode*(s: string): string =
|
||||
while inputIndex <= inputEnds:
|
||||
while s[inputIndex] in {'\n', '\r', ' '}:
|
||||
inc inputIndex
|
||||
# double check inputIndex as it can be incremented due to whitespace
|
||||
if inputIndex > inputEnds:
|
||||
break
|
||||
inputChar(a)
|
||||
inputChar(b)
|
||||
inputChar(c)
|
||||
|
||||
Reference in New Issue
Block a user