[devel] also check for negative out-of-range text compression mode
diff --git a/pngset.c b/pngset.c
index e49bf6d..a87b3e0 100644
--- a/pngset.c
+++ b/pngset.c
@@ -677,14 +677,15 @@
       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;