1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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.
This commit is contained in:
Ronald S. Bultje 2012-07-04 08:13:43 -07:00
parent f27386cdc7
commit fdaad6354f

View File

@ -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"