# HG changeset patch # User conrad # Date 1188951786 0 # Node ID 69e2592531b6b73d09f29d4c38d2c70479318181 # Parent 04ae6910d90374845ae37f06667b5f3ce66a0549 Write unknown size if the size given is too large for EBML (greater than 2^56-1) diff -r 04ae6910d903 -r 69e2592531b6 matroskaenc.c --- a/matroskaenc.c Wed Sep 05 00:23:03 2007 +0000 +++ b/matroskaenc.c Wed Sep 05 00:23:06 2007 +0000 @@ -46,11 +46,12 @@ 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--)