summary refs log tree commit diff stats
path: root/tests/stdlib
diff options
context:
space:
mode:
authorbptato <60043228+bptato@users.noreply.github.com>2024-04-22 09:44:33 +0200
committerGitHub <noreply@github.com>2024-04-22 09:44:33 +0200
commit30cf570af997a0c705f7b3f194eea7337cb44185 (patch)
tree34e56e5b0a0cf7e844e2a2dd01ad9004dffcc46e /tests/stdlib
parent60af04635f44e655c7928da36fc9394e11367d18 (diff)
downloadNim-30cf570af997a0c705f7b3f194eea7337cb44185.tar.gz
Fix std/base64.decode out of bounds read (#23526)
inputLen may end up as 0 in the loop if the input string only includes
trailing characters. e.g. without the patch, decode(" ") would panic.
Diffstat (limited to 'tests/stdlib')
-rw-r--r--tests/stdlib/tbase64.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/stdlib/tbase64.nim b/tests/stdlib/tbase64.nim
index 98388bb6c..c3bfb818e 100644
--- a/tests/stdlib/tbase64.nim
+++ b/tests/stdlib/tbase64.nim
@@ -18,6 +18,8 @@ template main() =
   doAssert encode("") == ""
   doAssert decode("") == ""
 
+  doAssert decode(" ") == ""
+
   const testInputExpandsTo76 = "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
   const testInputExpands = "++++++++++++++++++++++++++++++"
   const longText = """Man is distinguished, not only by his reason, but by this