Opened 15 months ago
Closed 15 months ago
#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
Fixed in 891167dee584b7c7760fe9a54bb65aec9bca0a56