https://github.com/BestImageViewer/geeqie/issues/818
For the images in the bug report, Exiv2 returns a pointer to a section
that is not a jpeg.
Include a check that a jpeg has been found.
Libraw >= 0.20 will display these files.
if (il->mapped_file)
{
- il->preview = IMAGE_LOADER_PREVIEW_EXIF;
+ /* Both exiv2 and libraw sometimes return a pointer to a file
+ * section that is not a jpeg */
+ if (!(il->mapped_file[0] == 0xFF && il->mapped_file[1] == 0xD8))
+ {
+ il->mapped_file = NULL;
+ }
+ else
+ {
+ il->preview = IMAGE_LOADER_PREVIEW_EXIF;
+ }
}
}
if (il->mapped_file)
{
- il->preview = IMAGE_LOADER_PREVIEW_LIBRAW;
+ if (!(il->mapped_file[0] == 0xFF && il->mapped_file[1] == 0xD8))
+ {
+ il->mapped_file = NULL;
+ }
+ else
+ {
+ il->preview = IMAGE_LOADER_PREVIEW_LIBRAW;
+ }
}
}