From: Stefan Esser Date: Tue, 1 Mar 2005 13:53:02 +0000 (+0000) Subject: Handle last or broken JP2 boxes correctly. X-Git-Tag: RELEASE_0_3~112 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=14abc19a76cc2ac56f476b7a5dbfcd4d042dabdb;p=php Handle last or broken JP2 boxes correctly. --- diff --git a/ext/standard/image.c b/ext/standard/image.c index 07f13f8048..a049284dfb 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -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;