From 59144327fbd13ed3a5387696f1011c9ec9ec7ce9 Mon Sep 17 00:00:00 2001 From: bptato Date: Sat, 27 Apr 2024 18:36:22 +0200 Subject: png: fix check in readU8 i + 1 must be > reader.limit, so >= is needed to avoid the addition --- src/img/png.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/img/png.nim') 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 -- cgit 1.4.1-2-gfad0