[devel] also check for negative out-of-range text compression mode

This commit is contained in:
Glenn Randers-Pehrson 2010-10-13 07:31:14 -05:00
parent e34f80e5aa
commit 79b2d64a67

View File

@ -677,14 +677,15 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr,
if (text_ptr[i].key == NULL) if (text_ptr[i].key == NULL)
continue; continue;
key_len = png_strlen(text_ptr[i].key); if (text_ptr[i].compression < PNG_TEXT_COMPRESSION_NONE ||
text_ptr[i].compression >= PNG_TEXT_COMPRESSION_LAST)
if (text_ptr[i].compression >= PNG_TEXT_COMPRESSION_LAST)
{ {
png_warning(png_ptr, "text compression mode is out of range"); png_warning(png_ptr, "text compression mode is out of range");
continue; continue;
} }
key_len = png_strlen(text_ptr[i].key);
if (text_ptr[i].compression <= 0) if (text_ptr[i].compression <= 0)
{ {
lang_len = 0; lang_len = 0;