diff options
author | Lode <lvandeve@gmail.com> | 2014-11-18 23:37:42 +0100 |
---|---|---|
committer | Lode <lvandeve@gmail.com> | 2014-11-18 23:37:42 +0100 |
commit | ba274d5b98d1582bba47a1591c9e02b1ff421352 (patch) | |
tree | 63a82d5e567b17bc140d67119ce8fd417651b972 /example_png_info.cpp | |
parent | c7353101cea671073ba1a9f4ca9f4cf7e8dbc944 (diff) |
protect against invalid chunk lengths in some tools
Diffstat (limited to 'example_png_info.cpp')
-rw-r--r-- | example_png_info.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/example_png_info.cpp b/example_png_info.cpp index 86f664a..e7f78a2 100644 --- a/example_png_info.cpp +++ b/example_png_info.cpp @@ -232,6 +232,10 @@ void displayFilterTypes(const std::vector<unsigned char>& buffer) { const unsigned char* cdata = lodepng_chunk_data_const(chunk); unsigned clength = lodepng_chunk_length(chunk); + if(chunk + clength >= end) { + std::cout << "invalid chunk length" << std::endl; + return; + } for(unsigned i = 0; i < clength; i++) { |