[FFmpeg-devel] Fix undefined behavior in ff_configure_buffers_for_index()
Dale Curtis
dalecurtis at chromium.org
Tue Feb 11 02:20:56 EET 2020
On Thu, Feb 6, 2020 at 3:38 PM Michael Niedermayer <michaelni at gmx.at> wrote:
> On Thu, Jan 30, 2020 at 11:23:07AM -0800, Dale Curtis wrote:
> > On Wed, Jan 29, 2020 at 10:23 PM Michael Niedermayer
> <michael at niedermayer.cc>
> > wrote:
> >
> > > so i think it works but maybe ive missed something, for which values
> > > of e2_pts do you see a problem with e1_pts = INT64_MIN?
> > >
> >
> > For e1_pts = INT64_MIN and e2_pts >= 0 you end up with a negative int64_t
> > result for e2_pts - (uint64_t)e1_pts, so it's always < time_tolerance. If
> > that's what you intended, then sgtm.
>
> thats what the code would do if the elemnts where large enough to not
> overflow
> so that seems to match whats intended.
>
> Do you see some issue here ?
>
Whoops, sorry, I just realized my previous comment was rejected from the
list since I used the wrong e-mail address. My previous statement was
incorrect. The code you proposed correctly promotes a uint64_t and not an
int64_t when used in a conditional. Here's what I wrote that got lost:
"Actually, this was a test construction error on my part. In a conditional
this does evaluate to a uint64_t vs int64_t, so the comparison is valid.
I've attached your recommended patch. Thanks for your patience."
- dale
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ubfix_v2.patch
Type: text/x-patch
Size: 1711 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200210/7b464aab/attachment.bin>
More information about the ffmpeg-devel
mailing list