diff options
author | Lode <lvandeve@gmail.com> | 2016-03-29 22:43:49 +0200 |
---|---|---|
committer | Lode <lvandeve@gmail.com> | 2016-03-29 22:43:49 +0200 |
commit | 3ea25a82805137025516375b8fdc005a8a951b18 (patch) | |
tree | 69a70304b4882c2825da919bec06bed4d7f90430 | |
parent | f1cc9511796075ac5294d691f6dc7cbf1090d068 (diff) |
ignore invalid data past IEND in chunk util
-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)); } |