#10460 closed defect (fixed)

gif decoder reuses buffer without flagging it

Reported by: delusional Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: gif
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

According to the get_buffer2 documentation the codec is supposed to signal that it'll reuse the returned buffer with the flag AV_GET_BUFFER_FLAG_REF[1].

The gif decoder doesn't set this flag

libavcodec/gifdec.c:492 if ((ret = ff_get_buffer(avctx, s->frame, 0)) < 0)

yet attempts to reuse the buffer until the next keyframe

libavcodec/gifdec.c:508 if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)

This leads to a bug in libav users that rely on get_buffer2 not being reused like gstreamer[2].

[1]: https://ffmpeg.org/doxygen/6.0/structAVCodecContext.html#aef79333a4c6abf1628c55d75ec82bede
[2]: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2792

Change History (1)

comment:1 by Elon Musk, 15 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.