]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Write unknown size if the size given is too large for EBML (greater than 2^56-1)
authorconrad <conrad@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 5 Sep 2007 00:23:06 +0000 (00:23 +0000)
committerconrad <conrad@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Wed, 5 Sep 2007 00:23:06 +0000 (00:23 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10309 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavformat/matroskaenc.c

index 44df0b67441695cd323bc66cb2f0c62ce1857e3e..41b9d6b06a8d06eab31c7c21ba97b94f17a50b55 100644 (file)
@@ -46,11 +46,12 @@ static void put_ebml_id(ByteIOContext *pb, unsigned int id)
 static void put_ebml_size(ByteIOContext *pb, uint64_t size, int minbytes)
 {
     int bytes = minbytes;
-    while (size >> (bytes*7 + 7)) bytes++;
 
     // sizes larger than this are currently undefined in EBML
-    // XXX: error condition?
-    if (size > (1ULL<<56)-1) return;
+    // so write "unknown" size
+    size = FFMIN(size, (1ULL<<56)-1);
+
+    while (size >> (bytes*7 + 7)) bytes++;
 
     put_byte(pb, (0x80 >> bytes) | (size >> bytes*8));
     for (bytes -= 1; bytes >= 0; bytes--)