On Mon, Jun 18, 2012 at 08:48:09PM +0100, Måns Rullgård wrote:
> Kostya Shishkov <[email protected]> writes:
> 
> > On Mon, Jun 18, 2012 at 08:18:38PM +0100, Mans Rullgard wrote:
> >> From: "Ronald S. Bultje" <[email protected]>
> >> 
> >> Since all operands involved are constants, the division can be
> >> computed at compile time whereas av_log2() cannot.
> >> ---
> >>  libavformat/mxfdec.c |    4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >> 
> >> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> >> index dd10240..15a0ac0 100644
> >> --- a/libavformat/mxfdec.c
> >> +++ b/libavformat/mxfdec.c
> >> @@ -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");
> >> -- 
> >
> > Isn't it / (sizeof(elem) * 2) ?
> 
> Yes, although I wonder where that came from.

>From Michael, I guess, probably by means of cargo culting.
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to