diff options
author | SlowRiot <rain.backnet@gmail.com> | 2014-11-27 04:13:51 +0000 |
---|---|---|
committer | SlowRiot <rain.backnet@gmail.com> | 2014-11-27 04:13:51 +0000 |
commit | e205cb35be0d53730ee8c8c8082255d3f50c5d12 (patch) | |
tree | 1d924292d24581ebad4bff1c7afd5437fd2f60b0 /lodepng_util.cpp | |
parent | e14137419c1d444ed61a6789bd3dd6942cdc7405 (diff) | |
parent | 71b8c3ad7338b41b43676ad4212f6d820d4ce193 (diff) |
Merge branch 'master' of https://github.com/lvandeve/lodepng
# By Lode (10) and others
# Via Lode
* 'master' of https://github.com/lvandeve/lodepng:
fix for C
fix examples
better bitpointer checks
small tweaks
Update lodepng.h
Update lodepng.cpp
avoid too big pixel sizes
predict idat size correctly for interlaced images
unit test was a bit slow like that
fix bug with encoding transparent single-pixel image
protect against invalid chunk lengths in some tools
fix pngdetail.cpp
collapsing duplicate branch
do not check unsigned windowsize for < 0
Conflicts:
lodepng.cpp
Diffstat (limited to 'lodepng_util.cpp')
-rw-r--r-- | lodepng_util.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lodepng_util.cpp b/lodepng_util.cpp index 3784b6e..37a6e73 100644 --- a/lodepng_util.cpp +++ b/lodepng_util.cpp @@ -51,8 +51,10 @@ unsigned getChunkInfo(std::vector<std::string>& names, std::vector<size_t>& size lodepng_chunk_type(type, chunk); if(std::string(type).size() != 4) return 1; + unsigned length = lodepng_chunk_length(chunk); + if(chunk + length + 12 > end) return 1; names.push_back(type); - sizes.push_back(lodepng_chunk_length(chunk)); + sizes.push_back(length); chunk = lodepng_chunk_next_const(chunk); } @@ -180,6 +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 + 12 > end) return 1; // corrupt chunk length for(unsigned i = 0; i < clength; i++) { |