[FFmpeg-cvslog] r12253 - trunk/libavformat/matroskaenc.c

Aurelien Jacobs aurel
Wed Feb 27 00:26:02 CET 2008


M?ns Rullg?rd wrote:

> aurel <subversion at mplayerhq.hu> writes:
> 
> > Author: aurel
> > Date: Tue Feb 26 23:35:07 2008
> > New Revision: 12253
> >
> > Log:
> > Avoid infinite loop.
> > uint64_t >> 64 is an undefined operation
> 
> It is indeed undefined, but out of interest, what odd behaviour did
> you see, and where?

For some files there was a call to put_ebml_uint() with
val = 0x8000000000000000, causing an infinite loop.

Here you can see the behavior of >>64 (on x86-64):

$ cat test.c
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv)
{
    uint64_t v = 0x8000000000000000;
    printf("%"PRIx64"\n", v>>atoi(argv[1]));
    return 0;
}
aurel at homer:~$ gcc -o test test.c
aurel at homer:~$ ./test 48
8000
aurel at homer:~$ ./test 64
8000000000000000

Aurel




More information about the ffmpeg-cvslog mailing list