Re: Bug#849696: libogre-1.9.0v5: Ogre games abort on startup with “basic_string::_M_construct null not valid” / freeimage API issues

James Cowgill jcowgill at debian.org
Sat Dec 31 23:13:07 UTC 2016


Hi,

On 31/12/16 17:49, Manuel A. Fernandez Montecelo wrote:
> 2016-12-30 02:33 James Cowgill:
>> On 29/12/16 21:52, Thibaut Girka wrote:
>>> This started happening since upgrading libfreeimage3, so this might
>>> be a bug in
>>> it rather than in Ogre itself, but I haven't investigated any further
>>> yet.
>>
>> This appears to be a regression in the Debian patch applied in
>> libfreeimage3 3.17.0+ds1-4.
>>
>> Ogre contains this (OgreMain/src/OgreFreeImageCodec.cpp:98):
>>> for (int i = 0; i < FreeImage_GetFIFCount(); ++i)
>>> {
>>>     // Skip DDS codec since FreeImage does not have the option
>>>     // to keep DXT data compressed, we'll use our own codec
>>>     if ((FREE_IMAGE_FORMAT)i == FIF_DDS)
>>>         continue;
>>>            
>>>     String exts(FreeImage_GetFIFExtensionList((FREE_IMAGE_FORMAT)i));
>> [loop body continues]
>> [String is typedefed to std::string]
>>
>> This code assumes that FreeImage_GetFIFExtensionList will never return
>> NULL for values of i between 0 and FreeImage_GetFIFCount(). However in
>> the most recent Debian version of freeimage,
>> FreeImage_GetFIFExtensionList(27 / FIF_FAXG3) does return NULL.
>>
>> It is unclear to me who is wrong here. The documentation does not
>> suggest anything about when FreeImage_GetFIFExtensionList can fail,
>> although the examples always check FreeImage_FIFSupportsReading before
>> calling it. Can any freeimage maintainer suggest the best way to fix
>> this?
> 
> Thanks for the analysis.
> 
> The comment on the patch seems to add some light as to the cause of this
> breakage:
> 
>  https://anonscm.debian.org/cgit/debian-science/packages/freeimage.git/commit/?id=a67fe8c111d0de919b7a6710d4dd5efe05fbf380
> 
> 
>  ++    //allows adding a NULL node in order to not mess up plugin
>  ++    //numbering when some are disabled. Otherwise there will be a
>  ++    //discrepancy between FREE_IMAGE_FORMAT enumerator values and the
>  ++    //actual format.
>  ++    m_plugin_map[(const int)m_plugin_map.size()] = 0;
> 
> 
> If freeimage plans to ship with this change and not revert it somehow,
> the OGRE plugin for freeimage needs to check for the possibility of
> having null nodes in this structure.
vvt
Yes, but my question is whether the freeimage API allows for this
patch. Either the patch is correct according to the API and OGRE should
be patched in both Debian and upstream, or the patch is wrong and an
alternate solution in freeimage should be found which doesn't return
NULLs. It seems like a bit of an unmaintainable hack to patch OGRE in
Debian only.

Also, I just did a search of the archive and cegui-mk2 is probably
broken by this bug as well:
http://sources.debian.net/src/cegui-mk2/0.8.7-1.3/cegui/src/ImageCodecModules/FreeImage/ImageCodec.cpp/?hl=58#L58

Thanks,
James

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/debian-science-maintainers/attachments/20161231/ba5a77d5/attachment.sig>


More information about the debian-science-maintainers mailing list