summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLode <lvandeve@gmail.com>2016-03-29 22:43:49 +0200
committerLode <lvandeve@gmail.com>2016-03-29 22:43:49 +0200
commit3ea25a82805137025516375b8fdc005a8a951b18 (patch)
tree69a70304b4882c2825da919bec06bed4d7f90430
parentf1cc9511796075ac5294d691f6dc7cbf1090d068 (diff)
ignore invalid data past IEND in chunk util
-rw-r--r--lodepng_util.cpp7
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));
}