Commit fdaad635 authored by Ronald S. Bultje's avatar Ronald S. Bultje
Browse files

mxfdec: replace x>>av_log2(sizeof(..)) by x/sizeof(..).

Also replace x>>av_log2(sizeof(..)) + 1 by x/sizeof(..). The +1 is
probably meant to emulate av_log2_ceil(sizeof(..)) in cases where ".."
is not a power of two.
parent f27386cd
......@@ -700,7 +700,7 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg
return 0;
else if (segment->nb_index_entries < 0 ||
segment->nb_index_entries >
(INT_MAX >> av_log2(sizeof(*segment->stream_offset_entries))))
(INT_MAX / sizeof(*segment->stream_offset_entries)))
return AVERROR(ENOMEM);
length = avio_rb32(pb);
......@@ -1084,7 +1084,7 @@ static int mxf_compute_ptses_fake_index(MXFContext *mxf, MXFIndexTable *index_ta
if (index_table->nb_ptses <= 0)
return 0;
if (index_table->nb_ptses > INT_MAX >> av_log2(sizeof(AVIndexEntry)) + 1)
if (index_table->nb_ptses > INT_MAX / sizeof(AVIndexEntry))
return AVERROR(ENOMEM);
index_table->ptses = av_mallocz(index_table->nb_ptses *
......@@ -1196,7 +1196,7 @@ static int mxf_compute_index_tables(MXFContext *mxf)
}
}
if (mxf->nb_index_tables > INT_MAX >> av_log2(sizeof(MXFIndexTable)) + 1 ||
if (mxf->nb_index_tables > INT_MAX / sizeof(MXFIndexTable) ||
!(mxf->index_tables = av_mallocz(mxf->nb_index_tables *
sizeof(MXFIndexTable)))) {
av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate index tables\n");
......@@ -1218,7 +1218,7 @@ static int mxf_compute_index_tables(MXFContext *mxf)
MXFIndexTable *t = &mxf->index_tables[j];
if (t->nb_segments >
(INT_MAX >> av_log2(sizeof(MXFIndexTableSegment *))) ||
(INT_MAX / sizeof(MXFIndexTableSegment *)) ||
!(t->segments = av_mallocz(t->nb_segments *
sizeof(MXFIndexTableSegment*)))) {
av_log(mxf->fc, AV_LOG_ERROR, "failed to allocate IndexTableSegment"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment