From: cristy Date: Tue, 14 Aug 2012 12:55:55 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~5139 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9e2d53c10d610e2e6099cdae06516926d133c321;p=imagemagick --- diff --git a/coders/jnx.c b/coders/jnx.c index 44486c64b..439cb001a 100644 --- a/coders/jnx.c +++ b/coders/jnx.c @@ -203,12 +203,12 @@ static Image *ReadJNXImage(const ImageInfo *image_info,ExceptionInfo *exception) jnx_level_info[i].scale=ReadBlobLSBLong(image); if (jnx_info.version > 3) { - unsigned short - c; - register ssize_t j; + unsigned short + c; + (void) ReadBlobLSBLong(image); j=0; while ((c=ReadBlobLSBShort(image)) != 0) @@ -243,6 +243,9 @@ static Image *ReadJNXImage(const ImageInfo *image_info,ExceptionInfo *exception) int tile_offset; + MagickOffsetType + restore_offset; + PointInfo northeast, southwest; @@ -264,7 +267,10 @@ static Image *ReadJNXImage(const ImageInfo *image_info,ExceptionInfo *exception) (void) ReadBlobLSBShort(image); /* height */ tile_length=ReadBlobLSBLong(image); tile_offset=(int) ReadBlobLSBLong(image); - offset=TellBlob(image); + restore_offset=TellBlob(image); + offset=SeekBlob(image,(MagickOffsetType) tile_offset,SEEK_SET); + if (offset != (MagickOffsetType) tile_offset) + continue; /* Read a tile. */ @@ -275,7 +281,6 @@ static Image *ReadJNXImage(const ImageInfo *image_info,ExceptionInfo *exception) images=DestroyImageList(images); ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); } - (void) SeekBlob(image,tile_offset,SEEK_SET); blob[0]=0xFF; blob[1]=0xD8; count=ReadBlob(image,tile_length,blob+2); @@ -291,10 +296,10 @@ static Image *ReadJNXImage(const ImageInfo *image_info,ExceptionInfo *exception) tile_image=BlobToImage(read_info,blob,tile_length+2,exception); read_info=DestroyImageInfo(read_info); blob=(unsigned char *) RelinquishMagickMemory(blob); - (void) SeekBlob(image,offset,SEEK_SET); + offset=SeekBlob(image,restore_offset,SEEK_SET); if (tile_image == (Image *) NULL) continue; - (void) CopyMagickString(tile_image->magick,image->magick,MaxTextExtent); + (void) CopyMagickString(tile_image->magick,image->magick,MaxTextExtent); (void) FormatImageProperty(tile_image,"jnx:northeast","%.20g,%.20g", northeast.x,northeast.y); (void) FormatImageProperty(tile_image,"jnx:southwest","%.20g,%.20g",