mirror of
https://github.com/status-im/nimPNG.git
synced 2025-02-28 04:00:46 +00:00
add exception error if predefinedFilters not enough
This commit is contained in:
parent
f5580d7d77
commit
c490027c55
@ -3150,6 +3150,10 @@ proc encoderCore(png: PNG) =
|
||||
(modeOut.paletteSize == 0 or modeOut.paletteSize > 256):
|
||||
raise PNGError("invalid palette size, it is only allowed to be 1-256")
|
||||
|
||||
if state.filterStrategy == LFS_PREDEFINED:
|
||||
if state.predefinedFilters.len < png.width:
|
||||
raise PNGError("predefinedFilters contains not enough filterType compared to image height")
|
||||
|
||||
let inputSize = getRawSize(png.width, png.height, modeIn)
|
||||
if png.pixels.len < inputSize:
|
||||
raise PNGError("not enough input to encode")
|
||||
|
Loading…
x
Reference in New Issue
Block a user