From 1aabcfdbaed72d091216579463dfd511ad1a7a3e Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sun, 10 Sep 2017 05:45:44 -0500 Subject: [PATCH] [libpng16] Trying to isolate oss-fuzz issue in png_set_text_2(). --- pngset.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pngset.c b/pngset.c index 6d441049f..15531bbe6 100644 --- a/pngset.c +++ b/pngset.c @@ -889,7 +889,18 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr, if (text_ptr[i].text[0] == '\0') text_0_is_0=1; - if (text_is_null || text_0_is_0) + if (text_is_null) + { + text_length = 0; +# ifdef PNG_iTXt_SUPPORTED + if (text_ptr[i].compression > 0) + textp->compression = PNG_ITXT_COMPRESSION_NONE; + + else +# endif + textp->compression = PNG_TEXT_COMPRESSION_NONE; + } + else if (text_0_is_0) { text_length = 0; # ifdef PNG_iTXt_SUPPORTED