From f062574aa4ee19d87aab51c15396d77042734ee8 Mon Sep 17 00:00:00 2001 From: bung87 Date: Mon, 20 Jul 2020 16:07:55 +0800 Subject: [PATCH] fix state.predefinedFilters.len check when filterStrategy is LFS_PREDEFINED --- nimPNG.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nimPNG.nim b/nimPNG.nim index f0449cd..bd4f40b 100644 --- a/nimPNG.nim +++ b/nimPNG.nim @@ -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: