Menu

#393 Some questions about DecodeImage in coders/gif.c

v1.0_(example)
closed-fixed
None
5
2016-11-26
2016-07-26
田生
No

I'm looking into the source code of coders/gif.c, I found there are something strange.

In the code available means how many valid values the code may be, while 0 ~ (available - 1) should be valid. But the source code line 235 check if (code > available) instead of if (code >= available). Is there something wrong or I misunderstood the code?

Another question is about line 261, which check if (code >= available). Since when code > available the control flow went to line 238 then break the loop. This block may only be reached if code == available. Is there something wrong here?

The third question is about the status variable in the loop of x (line 201~319). If some error occurred, the variable is been set to MagickFail, then break the loop. But after the loop of x, it should also break the loop of y in my understand. Why it continue the loop of y?

Discussion

  • Bob Friesenhahn

    Bob Friesenhahn - 2016-07-26

    On Tue, 26 Jul 2016, 田生 wrote:

    You have raised some interesting concerns which require detailed
    analysis. It would not surprise me if there is a flaw in this logic
    since some very large GIF animations fail.

    The third question is about the status variable in the loop of x
    (line 201~319). If some error occurred, the variable is been set to
    MagickFail, then break the loop. But after the loop of x, it should
    also break the loop of y in my understand. Why it continue the loop
    of y?

    This one seems like it may be an obvious bug unless perhaps there was
    a desire to attempt to decode the remaining rows in spite of an error
    while decoding a row.

    Bob

    --
    Bob Friesenhahn
    bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
    GraphicsMagick Maintainer, http://www.GraphicsMagick.org/

     
  • Bob Friesenhahn

    Bob Friesenhahn - 2016-11-26
    • status: open --> closed-fixed
    • assigned_to: Bob Friesenhahn
     
  • Bob Friesenhahn

    Bob Friesenhahn - 2016-11-26

    These issues are believed to be fixed by changeset 14965:ecfd062a75ca.

     

Log in to post a comment.

MongoDB Logo MongoDB