#47 DGifSavedExtensionToGCB unexpectedly returns GIF_ERROR

Ted Nolan

I was going through some code I had written for a Tcl extension with giflib to make sure I was checking all return values from the library functions. I found I was not checking the return value of DGifSavedExtensionToGCB, so I put in a check to throw an error if DGifSavedExtensionToGCB returned GIF_ERROR.

My code immediately started to fail, and I figured the extra check had identified a coding error on my part. However, after looking into the matter and the giflib source code, it seems to me that DGifSavedExtensionToGCB returns GIF_ERROR in the "normal" case where the image being decoded has no extension block. It seems to me that returning GIF_ERROR in this case is extreme. I can also see that defining a special return code for this case is probably overkill. I would recommend adding a note to the "Graphics control extension handling" to the giflib document explaining that a GIF_ERROR here is generally not serious (assuming your ImageIndex is correct).


  • Eric S. Raymond

    Eric S. Raymond - 2013-08-29
    • status: open --> accepted
  • Eric S. Raymond

    Eric S. Raymond - 2013-08-29
    • status: accepted --> closed

Log in to post a comment.