Bug#841089: wrong file type recognized for J2K and WEBP images (and most likely SGI, EXR, JP2, PFM, PICT, RAW, JXR)
Boris Lesner
boris.lesner.datexim at gmail.com
Wed Jan 4 12:47:31 UTC 2017
Hi,
I am not a FreeImage dev at all, just a user who encountered a bug and
tried to fix it.
Maybe my patch wasn't the best way to solve this issue, it passed a very
basic unit test
but was merely a suggestion.
The real problem here is that a previous debian patch in FreeImage,
disabled the support
for the Fax G3 format in FreeImage.
Long story short: this is the patch at the root of this issue. FreeImage
is not meant to be
used with only part of its image support.
The longer version:
This previous patch also baldy broke some client code
(in my case, using FreeImage to save a Jpeg2000 image actually saved it
as an OpenEXR,
this problem happened for many other formats). I short, the problem was
that some
enums (from FREE_IMAGE_FORMAT) naming image formats did no longer had
the intended meaning.
My patch fixed this issue but at the cost of NULL checking the return of
some API functions, or
calling FreeImage_FIFSupportsReading ().
However this may or may not be an API breakage since the FreeImage
documentation does not
says the returned pointers (at least for FreeImage_GetFIFExtensionList)
are not NULL (but
a quick code review *seems* to show that in practice they can be NULL
[1], even tough it is not
specified so). This may possibly break many clients (like OGRE) since
they relied on
unspecified behavior (and thus were not correct in the first place).
The best solution - I believe - is to put back the support for the G3
format. Since my patch and
the previous one both introduce some kind of API breakage. This is
mostly due to a badly designed
image format plugin system in FreeImage, I don't believe we can remove
support for a format
without changing the API.
As a side note, the first patch maybe already broke some clients of OGRE
as the G3 format is no
longer supported.
Best Regards,
-- Boris
[1] There are quite a few conditions that can cause this function to
return NULL but I'm not sure
they are ever fulfilled.
On 03/01/2017 12:50, James Cowgill wrote:
> Hi Boris,
>
> Your patch to fix this bug broke OGRE (completely - nothing that uses it
> will start) because it dereferences the NULL pointer now returned by
> FreeImage_GetFIFExtensionList. See https://bugs.debian.org/849696.
>
> Did you consider this when you wrote your patch? Who's right here - your
> patch or OGRE? I am concerned about this patch because it effectively
> changes the freeimage API and potentially forces a number of
> reverse-dependencies of freeimage to change their code.
>
> Thanks,
> James
>
More information about the debian-science-maintainers
mailing list