[FFmpeg-devel] [PATCH] Fix possible SIGFPEs with bad mov timings. Based on chromium patch 35_mov_bad_timings.patch

Ronald S. Bultje rsbultje
Thu Nov 19 18:12:30 CET 2009


Hi,

On Thu, Nov 19, 2009 at 1:45 AM, Baptiste Coudurier
<baptiste.coudurier at gmail.com> wrote:
> I don't like the < 0 check, but I guess we don't have much choice here.

Er...

A) AVURational (bikeshed!!!!111)
B) uint32_t num = READ_BE32(..), den = READ_BE32(..);
    if (num & 0x80000000 || den & 0x80000000) { den >>= 1; num >>= 1 }

It's not like this 32th bit is suddenly gonna cause a movie to go out of sync...

And even if you don't do that, don't ever set it to 1. DO NO SET IT TO
1. 1 is wrong. It is never correct. If you can't parse it, error out.
DO NOT SET IT TO 1.

if (den == 0 || num == 0) {
  return -AVERROR_INVALIDFILE;
} else if (num & 0x80000000 || den & 0x80000000) {
  interesting file
}

Ronald



More information about the ffmpeg-devel mailing list