Ensure magick buffer+file checks use consistent min length guard
Prevents a zero-length buffer from crashing GetImageMagick It looks like the fix for magick7 in #1642 is also now required for magick6 as the assertion appears to have been backported.
This commit is contained in:
parent
cdcf63f8e5
commit
b73bc3a855
@ -256,7 +256,7 @@ G_DEFINE_TYPE( VipsForeignLoadMagickBuffer, vips_foreign_load_magick_buffer,
|
|||||||
static gboolean
|
static gboolean
|
||||||
vips_foreign_load_magick_buffer_is_a_buffer( const void *buf, size_t len )
|
vips_foreign_load_magick_buffer_is_a_buffer( const void *buf, size_t len )
|
||||||
{
|
{
|
||||||
return( magick_ismagick( (const unsigned char *) buf, len ) );
|
return( len > 10 && magick_ismagick( (const unsigned char *) buf, len ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unfortunately, libMagick does not support header-only reads very well. See
|
/* Unfortunately, libMagick does not support header-only reads very well. See
|
||||||
|
Loading…
Reference in New Issue
Block a user