diff options
-rw-r--r-- | lodepng_util.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lodepng_util.cpp b/lodepng_util.cpp index 8c4def1..76efdea 100644 --- a/lodepng_util.cpp +++ b/lodepng_util.cpp @@ -95,8 +95,13 @@ unsigned getChunks(std::vector<std::string> names[3], { location = 2; } - else if(name != "IEND") + else if(name == "IEND") + { + break; // anything after IEND is not part of the PNG or the 3 groups here. + } + else { + if(next > end) return 1; // invalid chunk, content too far names[location].push_back(name); chunks[location].push_back(std::vector<unsigned char>(chunk, next)); } |