mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02: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 48a1a12968345bf673db1e1cbb5c64bd3529c50c Fix CID1633236
This commit is contained in:
parent
dfaade76db
commit
c98810ab47
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user