]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
makes really sure that no undefined behavior can happen
authoraurel <aurel@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 27 Feb 2008 00:53:34 +0000 (00:53 +0000)
committeraurel <aurel@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 27 Feb 2008 00:53:34 +0000 (00:53 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@12258 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavformat/matroskaenc.c

index 092790838743a1f3f343fd7a828b3c3e407819a9..00818b54fbd6cbf911d1f631d16733e091c71483 100644 (file)
@@ -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 < 8) bytes++;
+    while (bytes < 8 && val >> bytes*8) bytes++;
 
     put_ebml_id(pb, elementid);
     put_ebml_num(pb, bytes, 0);