mirror of https://git.ffmpeg.org/ffmpeg.git
mxfdec: avoid double free and leaks.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
c2ca0163af
commit
d7da4d47a6
|
@ -240,6 +240,8 @@ typedef struct {
|
||||||
enum MXFMetadataSetType type;
|
enum MXFMetadataSetType type;
|
||||||
} MXFMetadataReadTableEntry;
|
} MXFMetadataReadTableEntry;
|
||||||
|
|
||||||
|
static int mxf_read_close(AVFormatContext *s);
|
||||||
|
|
||||||
/* partial keys to match */
|
/* partial keys to match */
|
||||||
static const uint8_t mxf_header_partition_pack_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 };
|
static const uint8_t mxf_header_partition_pack_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 };
|
||||||
static const uint8_t mxf_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 };
|
static const uint8_t mxf_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 };
|
||||||
|
@ -1930,10 +1932,10 @@ static int mxf_read_header(AVFormatContext *s)
|
||||||
/* we need to do this before computing the index tables
|
/* we need to do this before computing the index tables
|
||||||
* to be able to fill in zero IndexDurations with st->duration */
|
* to be able to fill in zero IndexDurations with st->duration */
|
||||||
if ((ret = mxf_parse_structural_metadata(mxf)) < 0)
|
if ((ret = mxf_parse_structural_metadata(mxf)) < 0)
|
||||||
return ret;
|
goto fail;
|
||||||
|
|
||||||
if ((ret = mxf_compute_index_tables(mxf)) < 0)
|
if ((ret = mxf_compute_index_tables(mxf)) < 0)
|
||||||
return ret;
|
goto fail;
|
||||||
|
|
||||||
if (mxf->nb_index_tables > 1) {
|
if (mxf->nb_index_tables > 1) {
|
||||||
/* TODO: look up which IndexSID to use via EssenceContainerData */
|
/* TODO: look up which IndexSID to use via EssenceContainerData */
|
||||||
|
@ -1941,12 +1943,17 @@ static int mxf_read_header(AVFormatContext *s)
|
||||||
mxf->nb_index_tables, mxf->index_tables[0].index_sid);
|
mxf->nb_index_tables, mxf->index_tables[0].index_sid);
|
||||||
} else if (mxf->nb_index_tables == 0 && mxf->op == OPAtom) {
|
} else if (mxf->nb_index_tables == 0 && mxf->op == OPAtom) {
|
||||||
av_log(mxf->fc, AV_LOG_ERROR, "cannot demux OPAtom without an index\n");
|
av_log(mxf->fc, AV_LOG_ERROR, "cannot demux OPAtom without an index\n");
|
||||||
return AVERROR_INVALIDDATA;
|
ret = AVERROR_INVALIDDATA;
|
||||||
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
mxf_handle_small_eubc(s);
|
mxf_handle_small_eubc(s);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
fail:
|
||||||
|
mxf_read_close(s);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue