diff --git a/coders/jnx.c b/coders/jnx.c
index 44486c6..439cb00 100644
--- a/coders/jnx.c
+++ b/coders/jnx.c
@@ -203,12 +203,12 @@
     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 @@
       int
         tile_offset;
 
+      MagickOffsetType
+        restore_offset;
+
       PointInfo
         northeast,
         southwest;
@@ -264,7 +267,10 @@
       (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 @@
             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 @@
       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",