mirror of
https://github.com/status-im/nimPNG.git
synced 2025-01-30 14:24:49 +00:00
fixes #20, unreliable readStr
This commit is contained in:
parent
55a444cf5a
commit
efa7a47576
@ -896,7 +896,7 @@ proc parsePNG(s: Stream, settings: PNGDecoder): PNG =
|
||||
let length = s.readInt32BE()
|
||||
let chunkType = PNGChunkType(s.readInt32BE())
|
||||
|
||||
let data = s.readStr(length)
|
||||
let data = if length == 0: "" else: s.readStr(length)
|
||||
let crc = cast[uint32](s.readInt32BE())
|
||||
let calculatedCRC = crc32(crc32(0, $chunkType), data)
|
||||
if calculatedCRC != crc and not PNGDecoder(png.settings).ignoreCRC:
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Package
|
||||
version = "0.2.1"
|
||||
version = "0.2.2"
|
||||
author = "Andri Lim"
|
||||
description = "PNG encoder and decoder"
|
||||
license = "MIT"
|
||||
|
Loading…
x
Reference in New Issue
Block a user