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");
-- 
1.7.10.2

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to