[FFmpeg-devel] Fix undefined behavior in ff_configure_buffers_for_index()

Michael Niedermayer michaelni at gmx.at
Fri Feb 7 01:38:44 EET 2020


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 ?

If the idea is that extreem values are likely invalid and should be treated
special, then yes but to detect such values using the equations overflow
seems not correct. Similarly any other special values if they reach this
function should be checked for more explicitly 

Thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200207/2a4510a7/attachment.sig>


More information about the ffmpeg-devel mailing list