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

Albert J. Wong (王重傑) ajwong
Thu Nov 19 19:38:22 CET 2009

On Thu, Nov 19, 2009 at 9:12 AM, Ronald S. Bultje <rsbultje at gmail.com>wrote:

> 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.

Yeah...also, the time_scale value is just a plain int itself, which means
that negatives are at least "valid" programmatically regardless of spec.
 And having it be negative is pretty unexpected downstream.  Combine that
with the ease with which you can get signed-unsigned promotions accidentally
in C, and this just becomes an annoying risk.

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

Good point. Having a timescale in the 4-billion range is not likely going to
be very interesting.  I personally prefer the erroring out scenario approach
you outlined below rather than trying to "correct" the timescale from one
value w/o a great experience into another value w/o a great experience.
 I've attached another patch to that effect.  Let me know what you guys

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 35_mov_bad_timings_upstream.patch
Type: text/x-patch
Size: 739 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091119/79b8050e/attachment.bin>

More information about the ffmpeg-devel mailing list