summaryrefslogtreecommitdiff
path: root/lodepng_util.cpp
diff options
context:
space:
mode:
authorLode <lvandeve@gmail.com>2015-02-16 22:28:44 +0100
committerLode <lvandeve@gmail.com>2015-02-16 22:28:44 +0100
commit9eaef3d1764f0e1e0234362824d30fc2df51af4d (patch)
tree167f7f4f2061765a14fbad4252c5bb3a32968557 /lodepng_util.cpp
parent92ce45dc5ef0df405ce4b2fd7f3bbad30a7071f2 (diff)
minor fixes
Diffstat (limited to 'lodepng_util.cpp')
-rw-r--r--lodepng_util.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lodepng_util.cpp b/lodepng_util.cpp
index 3e59a52..ad67819 100644
--- a/lodepng_util.cpp
+++ b/lodepng_util.cpp
@@ -186,7 +186,10 @@ unsigned getFilterTypesInterlaced(std::vector<std::vector<unsigned char> >& filt
{
const unsigned char* cdata = lodepng_chunk_data_const(chunk);
unsigned clength = lodepng_chunk_length(chunk);
- if(chunk + clength + 12 > end) return 1; // corrupt chunk length
+ if(chunk + clength + 12 > end || clength > png.size() || chunk + clength + 12 < begin) {
+ // corrupt chunk length
+ return 1;
+ }
for(unsigned i = 0; i < clength; i++)
{