summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLode <lvandeve@gmail.com>2014-11-21 01:52:20 +0100
committerLode <lvandeve@gmail.com>2014-11-21 01:52:20 +0100
commitfe4e8b3693d489bf4b7d2711893075afd047a607 (patch)
tree2529f7abee1478a5f7ed442f6723529837e29f5a
parent6e1667e71a79dd57bf2bb04edd517a03af51aa90 (diff)
fix examples
-rw-r--r--example_png_info.cpp2
-rw-r--r--lodepng_util.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/example_png_info.cpp b/example_png_info.cpp
index c6df5c1..afd845c 100644
--- a/example_png_info.cpp
+++ b/example_png_info.cpp
@@ -232,7 +232,7 @@ 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) {
+ if(chunk + clength + 12 > end) {
std::cout << "invalid chunk length" << std::endl;
return;
}
diff --git a/lodepng_util.cpp b/lodepng_util.cpp
index ed054f0..37a6e73 100644
--- a/lodepng_util.cpp
+++ b/lodepng_util.cpp
@@ -52,7 +52,7 @@ unsigned getChunkInfo(std::vector<std::string>& names, std::vector<size_t>& size
if(std::string(type).size() != 4) return 1;
unsigned length = lodepng_chunk_length(chunk);
- if(chunk + length >= end) return 1;
+ if(chunk + length + 12 > end) return 1;
names.push_back(type);
sizes.push_back(length);
@@ -182,7 +182,7 @@ unsigned getFilterTypesInterlaced(std::vector<std::vector<unsigned char> >& filt
{
const unsigned char* cdata = lodepng_chunk_data_const(chunk);
unsigned clength = lodepng_chunk_length(chunk);
- if(chunk + clength >= end) return 1; // corrupt chunk length
+ if(chunk + clength + 12 > end) return 1; // corrupt chunk length
for(unsigned i = 0; i < clength; i++)
{