Thanks to visit codestin.com
Credit goes to github.com

Skip to content

optimize option in gif animation causes segfault #415

@sfeam

Description

@sfeam

libgd 2.2.5
In gd_gif_out::gdImageGifAnimAddCtx we find this comment:

            /* create optimized animation.  Compare this image to
               the previous image and crop the temporary copy of
               current image to include only changed rectangular
      [snip]
              Images should be of same size.  If not, a temporary
               copy is made with the same size as previous image.
             */

The "should be" remark is true, but in fact no such copy is made.
As a result, whenever (tim->sy > prev_tim->sy) the code segfaults while trying to compare pixels.

De-selecting optimization avoids the bad code and image generation proceeds normally.
The problem was found while tracing a segfault generated by calls into libgd from gnuplot.
https://sourceforge.net/p/gnuplot/bugs/1992/
It is 100% reproducible on multiple platforms, but I have not tried to construct a small artificial demonstration code not involving gnuplot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions