Merge pull request #51 from bung87/master

fix state.predefinedFilters.len check when filterStrategy is LFS_PRED…
This commit is contained in:
andri lim 2020-07-20 16:24:20 +07:00 committed by GitHub
commit 89c433f1a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2847,8 +2847,8 @@ proc encoderCore[T](png: PNG[T]) =
raise PNGFatal("invalid palette size, it is only allowed to be 1-256")
if state.filterStrategy == LFS_PREDEFINED:
if state.predefinedFilters.len < png.width:
raise PNGFatal("predefinedFilters contains not enough filterType compared to image height")
if state.predefinedFilters.len != png.height:
raise PNGFatal("predefinedFilters length not equals to image height")
let inputSize = getRawSize(png.width, png.height, modeIn)
if png.pixels.len < inputSize: