From 858c0315b3ce46ca697491c9874ef3f65fa9a46b Mon Sep 17 00:00:00 2001 From: bptato Date: Thu, 25 Apr 2024 07:23:26 +0200 Subject: png: fix off by one + remove outdated comment --- src/img/png.nim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/img/png.nim') diff --git a/src/img/png.nim b/src/img/png.nim index bd7e6206..d41360a3 100644 --- a/src/img/png.nim +++ b/src/img/png.nim @@ -266,11 +266,9 @@ func paethPredictor(a, b, c: uint16): uint16 = return if pa <= pb and pa <= pc: a elif pb <= pc: b else: c proc unfilter(reader: var PNGReader; irow: openArray[uint8]; bpp: int) = - # none, sub, up -> replace uprow directly - # average, paeth -> copy to temp array, then replace uprow case irow[0] of 0u8: # none - copyMem(addr reader.uprow[0], unsafeAddr irow[1], irow.len) + copyMem(addr reader.uprow[0], unsafeAddr irow[1], irow.len - 1) of 1u8: # sub for i in 1 ..< irow.len: let j = i - 1 # skip filter byte -- cgit 1.4.1-2-gfad0