From 86b9245dd69b1ea7ba9a4f73fd3651808052ca6c Mon Sep 17 00:00:00 2001 From: Miroslav Shubernetskiy Date: Tue, 24 Feb 2026 03:37:46 -0500 Subject: [PATCH] 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 --- lib/pure/base64.nim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/pure/base64.nim b/lib/pure/base64.nim index 3b8fb9b681..f238862508 100644 --- a/lib/pure/base64.nim +++ b/lib/pure/base64.nim @@ -255,6 +255,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)