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

2020-02-11 Thread Michael Niedermayer
On Mon, Feb 10, 2020 at 04:20:56PM -0800, Dale Curtis wrote: > On Thu, Feb 6, 2020 at 3:38 PM Michael Niedermayer 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 > > > > > wrote: > > > > > > > so i think it work

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

2020-02-10 Thread Dale Curtis
On Thu, Feb 6, 2020 at 3:38 PM Michael Niedermayer 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 > > > wrote: > > > > > so i think it works but maybe ive missed something, for which values > > > of e2_pts do you see

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

2020-02-06 Thread Michael Niedermayer
On Thu, Jan 30, 2020 at 11:23:07AM -0800, Dale Curtis wrote: > On Wed, Jan 29, 2020 at 10:23 PM Michael Niedermayer > 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 e

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

2020-02-06 Thread Dale Curtis
Bump to apply? - dale On Thu, Jan 30, 2020 at 3:21 PM Dale Curtis wrote: > On Thu, Jan 30, 2020 at 11:23 AM Dale Curtis > wrote: > >> On Wed, Jan 29, 2020 at 10:23 PM Michael Niedermayer >> wrote: >> >>> so i think it works but maybe ive missed something, for which values >>> of e2_pts do you

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

2020-01-30 Thread Dale Curtis
On Wed, Jan 29, 2020 at 10:23 PM Michael Niedermayer 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)e

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

2020-01-29 Thread Michael Niedermayer
On Wed, Jan 29, 2020 at 03:25:32PM -0800, Dale Curtis wrote: > On Wed, Jan 29, 2020 at 4:55 AM Michael Niedermayer > wrote: > > > simpler solution, and also behaves arithmetically more correct when the > > overflow happens in the othert direction: > > > > av_assert0(time_tolerance >= 0); > > > >

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

2020-01-29 Thread Dale Curtis
On Wed, Jan 29, 2020 at 4:55 AM Michael Niedermayer wrote: > simpler solution, and also behaves arithmetically more correct when the > overflow happens in the othert direction: > > av_assert0(time_tolerance >= 0); > > if (e2_pts < e1_pts || e2_pts - (uint64_t)e1_pts < time_tolerance) > Does that

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

2020-01-29 Thread Michael Niedermayer
On Tue, Jan 28, 2020 at 04:52:16PM -0800, Dale Curtis wrote: > When e2_pts == INT64_MIN and e1_pts >= 0 the calculation of > e2_pts - e1_pts will overflow an int64_t. So instead check > for overflow and default to |time_tolerance| if the value > is too large for an int64_t. > > Signed-off-by: Dale

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

2020-01-28 Thread Dale Curtis
When e2_pts == INT64_MIN and e1_pts >= 0 the calculation of e2_pts - e1_pts will overflow an int64_t. So instead check for overflow and default to |time_tolerance| if the value is too large for an int64_t. Signed-off-by: Dale Curtis From 412751f4747faf34e3dba088dc55290783eb6bd5 Mon Sep 17 00:00:0