mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-02-04 14:30:55 +08:00
avcodec/hw_base_encode: fix use after free on close
The way the linked list of images was freed caused a
use after free, by accessing pic->next after pic was
already freed.
Regression from 48a1a12968
Fix CID1633236
This commit is contained in:
@@ -804,10 +804,10 @@ int ff_hw_base_encode_init(AVCodecContext *avctx, FFHWBaseEncodeContext *ctx)
|
||||
|
||||
int ff_hw_base_encode_close(FFHWBaseEncodeContext *ctx)
|
||||
{
|
||||
FFHWBaseEncodePicture *pic;
|
||||
|
||||
for (pic = ctx->pic_start; pic; pic = pic->next)
|
||||
for (FFHWBaseEncodePicture *pic = ctx->pic_start, *next_pic = pic; pic; pic = next_pic) {
|
||||
next_pic = pic->next;
|
||||
base_encode_pic_free(pic);
|
||||
}
|
||||
|
||||
av_fifo_freep2(&ctx->encode_fifo);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user