#227 GIF palette

None
closed
None
5
2014-03-23
2013-05-22
Artem
No

I use your library in own project (http://code.google.com/p/farplugs/wiki/ImageView), thanks for your work!

But I have trouble with animated GIF - after loading file I can see only top part if the image, any other files showed without problems.

Test image attached.
P.S. Sorry for file content, I have received it from other user :-)

1 Attachments

Discussion

  • Hervé Drolon

    Hervé Drolon - 2013-11-19
    • assigned_to: Hervé Drolon
    • Group: -->
     
  • Hervé Drolon

    Hervé Drolon - 2013-11-19

    [from MihailNaydenov]

    There is a bug regarding GIFs (https://sourceforge.net/p/freeimage/bugs/227/)
    It is much more severe then expected and affects probably 1/4 of all (modern) GIFs, I tested.
    Here are some more examples:

    http://kuvaton.com/browse/28142/darwin_awards_goes_to.gif
    http://kuvaton.com/browse/28139/skills43.gif
    http://kuvaton.com/browse/28122/pet_me.gif
    http://kuvaton.com/browse/28101/origami_rhino.gif
    http://kuvaton.com/browse/28092/surprise_pillow.gif

    All these open OK everywhere!

    SOLUTION:

    The problem turned out to be line 375 in PluginGIF.spp:

    if( code > m_nextCode || (m_nextCode == MAX_LZW_CODE && code != m_clearCode) || code == m_endCode )

    The middle section (m_nextCode == MAX_LZW_CODE && code != m_clearCode) is the part that fails.
    At some point the codes table is filled up and m_nextCode == MAX_LZW_CODE.
    Although this is not "normal", it could happen and it is best to just use the table as-is without inserting new values, at least this is the advice LibGIF gives in its comments.

    Removing this test and instead adding a check for (m_nextCode < MAX_LZW_CODE) before inserting into m_strings[m_nextCode] loads all said images much like all other viewers and browsers.
    Of course it might be a better solution, be someone with more expertise on both the lzw decomp. and the plugin itself.

    MihailNaydenov

     
  • Hervé Drolon

    Hervé Drolon - 2013-11-26
    • status: open --> pending
     
  • Hervé Drolon

    Hervé Drolon - 2013-11-26

    Thanks to MihailNaydenov,

    This bug is now fixed in the CVS.

    Hervé

     
  • Hervé Drolon

    Hervé Drolon - 2014-03-23
    • status: pending --> closed
     
  • Hervé Drolon

    Hervé Drolon - 2014-03-23

    fixed in release 3.16.0

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks