I try to load a in-memory wmf image, got the stack overflow exception. I couldn't figure out which steps I missed. The exception is generated at ReadPSImage in the ps.c, and the wmf file is in the WMF fold coming with IM.
- my env: IM 6.6.7
installed GS 9.00 (x86)
sys: win2008 R2
Code: Select all
int main(int argc, char** argv)
{
MagickCoreGenesis(*argv,MagickTrue);
FILE* file = NULL;
if( fopen_s( &file, "anim0002.wmf", "rb" ) != 0)
{
printf("load file error");
exit(1);
}
fseek(file, 0, SEEK_END);
size_t length = ftell(file);
fseek(file, 0, SEEK_SET);
BYTE* databyte = new BYTE[length];
int rlength = fread(databyte, 1, length, file);
Image* image = NULL;
ImageInfo *image_info;
ExceptionInfo* exception = AcquireExceptionInfo();
image_info=AcquireImageInfo();
try
{
image = BlobToImage(image_info, databyte, length, &exception);
}
catch(...)
{
return 1;
}
delete [] databyte;
fclose(file);
if(image != NULL)
{
DestroyImage(image);
}
MagickCoreTerminus();
return 0;
}