]> granicus.if.org Git - php/commitdiff
Handle last or broken JP2 boxes correctly.
authorStefan Esser <sesser@php.net>
Tue, 1 Mar 2005 13:53:02 +0000 (13:53 +0000)
committerStefan Esser <sesser@php.net>
Tue, 1 Mar 2005 13:53:02 +0000 (13:53 +0000)
ext/standard/image.c

index 07f13f8048d2d6617e9631d65c6366b6fd3ea512..a049284dfb3c8fe136f7f261ae6e06dbb91c8bae 100644 (file)
@@ -708,6 +708,11 @@ static struct gfxinfo *php_handle_jp2(php_stream *stream TSRMLS_DC)
                        break;
                }
 
+               /* Stop if this was the last box */
+               if ((int)box_length <= 0) {
+                       break;
+               }
+
                /* Skip over LBox (Which includes both TBox and LBox itself */
                if (php_stream_seek(stream, box_length - 8, SEEK_CUR)) {
                        break;