[SCM] libav/experimental: Avoid infinite loop. uint64_t >> 64 is an undefined operation

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:15:51 UTC 2013


The following commit has been merged in the experimental branch:
commit d597655f771979c70c08f8f8ed84c1319da121e8
Author: Aurelien Jacobs <aurel at gnuage.org>
Date:   Tue Feb 26 22:35:07 2008 +0000

    Avoid infinite loop.
    uint64_t >> 64 is an undefined operation
    
    Originally committed as revision 12253 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 2c1f542..0927908 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -149,7 +149,7 @@ static void put_ebml_num(ByteIOContext *pb, uint64_t num, int bytes)
 static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t val)
 {
     int i, bytes = 1;
-    while (val >> bytes*8) bytes++;
+    while (val >> bytes*8 && bytes < 8) bytes++;
 
     put_ebml_id(pb, elementid);
     put_ebml_num(pb, bytes, 0);

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list