about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-04-27 18:36:22 +0200
committerbptato <nincsnevem662@gmail.com>2024-04-27 18:36:22 +0200
commit59144327fbd13ed3a5387696f1011c9ec9ec7ce9 (patch)
treed45a69931d96da9dec6006a432afed65df4e066b
parente78872f3df05bb1441bc135f58b8a8b1081b53d4 (diff)
downloadchawan-59144327fbd13ed3a5387696f1011c9ec9ec7ce9.tar.gz
png: fix check in readU8
i + 1 must be > reader.limit, so >= is needed to avoid the addition
-rw-r--r--src/img/png.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/img/png.nim b/src/img/png.nim
index db1fa5a9..667b589f 100644
--- a/src/img/png.nim
+++ b/src/img/png.nim
@@ -154,7 +154,7 @@ template readStr(reader: var PNGReader; L: int): string =
   s
 
 template readU8(reader: var PNGReader): uint8 =
-  if reader.i > reader.limit:
+  if reader.i >= reader.limit:
     reader.err "too short"
   let x = reader.iq[reader.i]
   inc reader.i