static int GetCharacter(j_decompress_ptr jpeg_info)
{
if (jpeg_info->src->bytes_in_buffer == 0)
- (void) (*jpeg_info->src->fill_input_buffer)(jpeg_info);
+ {
+ (void) (*jpeg_info->src->fill_input_buffer)(jpeg_info);
+ if (jpeg_info->err->msg_code == JWRN_JPEG_EOF)
+ return EOF;
+ }
jpeg_info->src->bytes_in_buffer--;
return((int) GETJOCTET(*jpeg_info->src->next_input_byte++));
}
*/
error_manager->profile=comment;
p=GetStringInfoDatum(comment);
- for (i=0; i < (ssize_t) GetStringInfoLength(comment); i++)
+ for (i=0; i < (ssize_t) length; i++)
{
int
c;
}
*p='\0';
error_manager->profile=NULL;
+ if (i != (ssize_t) length)
+ {
+ comment=DestroyStringInfo(comment);
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ CorruptImageError,"InsufficientImageDataInFile","`%s'",
+ image->filename);
+ return(FALSE);
+ }
p=GetStringInfoDatum(comment);
(void) SetImageProperty(image,"comment",(const char *) p,exception);
comment=DestroyStringInfo(comment);
}
error_manager->profile=profile;
p=GetStringInfoDatum(profile);
- for (i=(ssize_t) GetStringInfoLength(profile)-1; i >= 0; i--)
+ for (i=0; i < (ssize_t) length; i++)
{
int
c;
break;
*p++=(unsigned char) c;
}
+ if (i != (ssize_t) length)
+ {
+ profile=DestroyStringInfo(profile);
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ CorruptImageError,"InsufficientImageDataInFile","`%s'",
+ image->filename);
+ return(FALSE);
+ }
error_manager->profile=NULL;
icc_profile=(StringInfo *) GetImageProfile(image,"icc");
if (icc_profile != (StringInfo *) NULL)
}
error_manager->profile=profile;
p=GetStringInfoDatum(profile);
- for (i=0; i < (ssize_t) GetStringInfoLength(profile); i++)
+ for (i=0; i < (ssize_t) length; i++)
{
int
c;
*p++=(unsigned char) c;
}
error_manager->profile=NULL;
+ if (i != (ssize_t) length)
+ {
+ profile=DestroyStringInfo(profile);
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ CorruptImageError,"InsufficientImageDataInFile","`%s'",
+ image->filename);
+ return(FALSE);
+ }
/* The IPTC profile is actually an 8bim */
iptc_profile=(StringInfo *) GetImageProfile(image,"8bim");
if (iptc_profile != (StringInfo *) NULL)
}
error_manager->profile=profile;
p=GetStringInfoDatum(profile);
- for (i=0; i < (ssize_t) GetStringInfoLength(profile); i++)
+ for (i=0; i < (ssize_t) length; i++)
{
int
c;
*p++=(unsigned char) c;
}
error_manager->profile=NULL;
+ if (i != (ssize_t) length)
+ {
+ profile=DestroyStringInfo(profile);
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ CorruptImageError,"InsufficientImageDataInFile","`%s'",
+ image->filename);
+ return(FALSE);
+ }
if (marker == 1)
{
p=GetStringInfoDatum(profile);