From 79b2d64a672b3bf657bfacc9d0b0cae6293e34f2 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Wed, 13 Oct 2010 07:31:14 -0500 Subject: [PATCH] [devel] also check for negative out-of-range text compression mode --- pngset.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pngset.c b/pngset.c index e49bf6dc4..a87b3e066 100644 --- a/pngset.c +++ b/pngset.c @@ -677,14 +677,15 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, if (text_ptr[i].key == NULL) continue; - key_len = png_strlen(text_ptr[i].key); - - if (text_ptr[i].compression >= PNG_TEXT_COMPRESSION_LAST) + if (text_ptr[i].compression < PNG_TEXT_COMPRESSION_NONE || + text_ptr[i].compression >= PNG_TEXT_COMPRESSION_LAST) { png_warning(png_ptr, "text compression mode is out of range"); continue; } + key_len = png_strlen(text_ptr[i].key); + if (text_ptr[i].compression <= 0) { lang_len = 0;