diff -r -U 3 libpng-1.0.5/pngrutil.c libpng-1.0.5patch03a/pngrutil.c
--- libpng-1.0.5/pngrutil.c	Thu Oct 14 07:43:08 1999
+++ libpng-1.0.5patch03a/pngrutil.c	Fri Jul 23 22:41:02 2004
@@ -754,7 +754,8 @@
          /* Should be an error, but we can cope with it */
          png_warning(png_ptr, "Missing PLTE before tRNS");
       }
-      else if (length > png_ptr->num_palette)
+      if (length > (png_uint_32)png_ptr->num_palette ||
+          length > 256)
       {
          png_warning(png_ptr, "Incorrect tRNS chunk length");
          png_crc_finish(png_ptr, length);