Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/lvandeve/lodepng.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Foley <bpfoley@google.com>2019-10-21 00:41:14 +0300
committerBrian Foley <bpfoley@google.com>2019-10-21 00:54:22 +0300
commit58a977571889e9b296b23d643e6ed27fd70f9c82 (patch)
tree196720f71c3e5fa25fe778c10917c33b1611c607 /lodepng.cpp
parent3e74e9f4c293c458fd0d73c01c18bf911a4f12c1 (diff)
Fix null pointer derefs decoding paletteized data without PLTE chunk.
Diffstat (limited to 'lodepng.cpp')
-rw-r--r--lodepng.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lodepng.cpp b/lodepng.cpp
index 02bf99b..2aafb55 100644
--- a/lodepng.cpp
+++ b/lodepng.cpp
@@ -4874,6 +4874,11 @@ unsigned lodepng_decode(unsigned char** out, unsigned* w, unsigned* h,
}
} else {
/*color conversion needed; sort of copy of the data*/
+ if (state->info_png.color.colortype == LCT_PALETTE
+ && !state->info_png.color.palette) {
+ return 106; /* error: Missing palette */
+ }
+
unsigned char* data = *out;
size_t outsize;