From 3ea25a82805137025516375b8fdc005a8a951b18 Mon Sep 17 00:00:00 2001 From: Lode Date: Tue, 29 Mar 2016 22:43:49 +0200 Subject: ignore invalid data past IEND in chunk util --- lodepng_util.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 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(chunk, next)); } -- cgit v1.2.3