MagickCore/blob.c/ReadBlob hangs when reading from Blob created in memory
Posted: 2016-04-27T09:13:40-07:00
IM: 6.9.3-8
Platform: Win10, MSVC 14, x64
File: magick\blob.c, line 2851
Using Magick++ and MagickCore, the following code produces what seems to be an infinite hang on line 2851 of blob.c:
The offending line of code seems to attempt to be reading from a file that doesn't exist, from blob.c:
However, the following code works fine, likely due to there being a valid file handle:
I doubt this is a common use case but it did uncover a bug in MagickCore that could probably use some attention one day. Thank you
Edit: Sorry I just noticed there is a 'Bug' forum, this should have went there.
Platform: Win10, MSVC 14, x64
File: magick\blob.c, line 2851
Using Magick++ and MagickCore, the following code produces what seems to be an infinite hang on line 2851 of blob.c:
Code: Select all
auto b = Magick::Blob( [image data in uchar*], [size of data] );
auto img = Magick::Image( b );
MagickCore::ExceptionInfo *exceptionInfo;
exceptionInfo = MagickCore::AcquireExceptionInfo();
ReadImages( img.constImageInfo(), exceptionInfo ); // hangs here!
(void)MagickCore::DestroyExceptionInfo( exceptionInfo );
Code: Select all
switch (image->blob->type)
{
case UndefinedStream:
break;
case StandardStream:
case FileStream:
case PipeStream:
{
switch (length)
{
default:
{
count=(ssize_t) fread(q,1,length,image->blob->file_info.file); // hangs here
Code: Select all
auto img = Magick::Image( "path/to/image.ext" );
MagickCore::ExceptionInfo *exceptionInfo;
exceptionInfo = MagickCore::AcquireExceptionInfo();
ReadImages( img.constImageInfo(), exceptionInfo ); // works fine
(void)MagickCore::DestroyExceptionInfo( exceptionInfo );
Edit: Sorry I just noticed there is a 'Bug' forum, this should have went there.