From 0b247953c8c63baba1da93e555baff177cdf2137 Mon Sep 17 00:00:00 2001 From: Aurelien Jacobs Date: Wed, 27 Feb 2008 00:53:34 +0000 Subject: [PATCH] makes really sure that no undefined behavior can happen Originally committed as revision 12258 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/matroskaenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 0927908387..00818b54fb 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 < 8) bytes++; + while (bytes < 8 && val >> bytes*8) bytes++; put_ebml_id(pb, elementid); put_ebml_num(pb, bytes, 0);