summaryrefslogtreecommitdiff
path: root/lodepng_util.cpp
diff options
context:
space:
mode:
authorLode <lvandeve@gmail.com>2018-01-16 00:14:49 +0100
committerLode <lvandeve@gmail.com>2018-01-16 00:14:49 +0100
commit93e348fc8ee50729b2bfc3d602df2cae6051a40e (patch)
treee6a58ce56e3a811f15c1c92c5bb2e5de14896c46 /lodepng_util.cpp
parentd4d8f1aa786571af4a90a41b3db048043f114629 (diff)
display more info for corrupt pngs
Diffstat (limited to 'lodepng_util.cpp')
-rw-r--r--lodepng_util.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lodepng_util.cpp b/lodepng_util.cpp
index 9d86686..6fa1618 100644
--- a/lodepng_util.cpp
+++ b/lodepng_util.cpp
@@ -185,7 +185,7 @@ unsigned getFilterTypesInterlaced(std::vector<std::vector<unsigned char> >& filt
{
char type[5];
lodepng_chunk_type(type, chunk);
- if(std::string(type).size() != 4) return 1; //Probably not a PNG file
+ if(std::string(type).size() != 4) break; //Probably not a PNG file
if(std::string(type) == "IDAT")
{
@@ -203,11 +203,11 @@ unsigned getFilterTypesInterlaced(std::vector<std::vector<unsigned char> >& filt
}
next = lodepng_chunk_next_const(chunk);
- if (next <= chunk) return 1; // integer overflow
+ if (next <= chunk) break; // integer overflow
chunk = next;
}
- //Decompress all IDAT data
+ //Decompress all IDAT data (if the while loop ended early, this might fail)
std::vector<unsigned char> data;
error = lodepng::decompress(data, &zdata[0], zdata.size());