History

avformat/demux: Fix segfault due to avcodec_open2 failure

Fixes 'ffprobe 1_poc.mp4' segfault introduced with commit 0021484d05f9b0f032fa319399de6e24eea0c04f codec_close should not assume that the codec_id did not change.

Pavel Koshevoy committed 1 year ago

Commit 59a66601 parent 18c62241 file · +7 −1Browse files

Unified · Split

libavformat/demux.c+7−1
@@ -1292,9 +1292,15 @@ static int codec_close(FFStream *sti) · 1291 unmodified lines
1292{1292{
1293 AVCodecContext *avctx_new = NULL;1293 AVCodecContext *avctx_new = NULL;
1294 AVCodecParameters *par_tmp = NULL;1294 AVCodecParameters *par_tmp = NULL;
1295 const AVCodec *new_codec = NULL;
1295 int ret;1296 int ret;
1296 1297
1297 avctx_new = avcodec_alloc_context3(sti->avctx->codec);1298 new_codec =
1299 (sti->avctx->codec_id != sti->pub.codecpar->codec_id) ?
1300 avcodec_find_decoder(sti->pub.codecpar->codec_id) :
1301 sti->avctx->codec;
1302
1303 avctx_new = avcodec_alloc_context3(new_codec);
1298 if (!avctx_new) {1304 if (!avctx_new) {
1299 ret = AVERROR(ENOMEM);1305 ret = AVERROR(ENOMEM);
1300 goto fail;1306 goto fail;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t