Read offset table.
*/
for (i=0; i < (ssize_t) stream_info->remaining; i++)
- (void) ReadBlobByte(image);
+ if (ReadBlobByte(image) == EOF)
+ break;
(void) (((ssize_t) ReadBlobLSBShort(image) << 16) |
ReadBlobLSBShort(image));
length=(size_t) ReadBlobLSBLong(image);
stream_info->offset_count=length >> 2;
if (stream_info->offset_count != 0)
{
- if (stream_info->offsets != (ssize_t *) NULL)
+ if (stream_info->offsets != (ssize_t *) NULL)
stream_info->offsets=(ssize_t *) RelinquishMagickMemory(
stream_info->offsets);
stream_info->offsets=(ssize_t *) AcquireQuantumMemory(
"UnableToCreateTemporaryFile",filename);
break;
}
- for ( ; length != 0; length--)
+ for (c=EOF; length != 0; length--)
{
c=ReadBlobByte(image);
if (c == EOF)
(void) fputc(c,file);
}
(void) fclose(file);
+ if (c == EOF)
+ break;
(void) FormatLocaleString(read_info->filename,MagickPathExtent,
"jpeg:%s",filename);
if (image->compression == JPEG2000Compression)