summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLode Vandevenne <lvandeve@users.noreply.github.com>2016-01-06 17:07:17 +0000
committerLode Vandevenne <lvandeve@users.noreply.github.com>2016-01-06 17:07:17 +0000
commitc5861e57077f044f279b752a74cabc2ed1169d00 (patch)
tree0dbeaa40eecaa283878b6f407f6f8f0460803c78
parent9f3acec682697642ebccdf8659c8b53bf05001f1 (diff)
parentbde23098b4fab880614bcad2e1d6a0ce47b7b5b4 (diff)
Merge pull request #30 from Flameeyes/master
Fix crash on PNG files with a single column of pixels.
-rw-r--r--lodepng_util.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lodepng_util.cpp b/lodepng_util.cpp
index ad67819..8c4def1 100644
--- a/lodepng_util.cpp
+++ b/lodepng_util.cpp
@@ -233,7 +233,8 @@ unsigned getFilterTypesInterlaced(std::vector<std::vector<unsigned char> >& filt
{
unsigned w2 = (w - ADAM7_IX[j] + ADAM7_DX[j] - 1) / ADAM7_DX[j];
unsigned h2 = (h - ADAM7_IY[j] + ADAM7_DY[j] - 1) / ADAM7_DY[j];
- if(ADAM7_IX[j] >= w || ADAM7_IY[j] >= h) w2 = h2 = 0;
+ if(ADAM7_IX[j] >= w) w2 = 0;
+ if(ADAM7_IY[j] >= h) h2 = 0;
size_t linebytes = 1 + lodepng_get_raw_size(w2, 1, &state.info_png.color);
for(size_t i = 0; i < h2; i++)
{