[FFmpeg-devel] [PATCH] [libavformat] Avoid integer overflow on start_time with skip_samples.

Dale Curtis dalecurtis at chromium.org
Thu Apr 30 23:26:20 EEST 2020


Aside: This overflow check is used in quite a few places now. I wonder if
it's worth having a function like the following:

int64_t av_no_overflow_add(int64_t a, int64_t b) {
  return (a > 0 ? b <= INT64_MAX - a : b >= INT64_MIN - a) ? a + b : a;
}

Better name suggestions welcome... av_maybe_add_ts?

On Thu, Apr 30, 2020 at 1:17 PM Dale Curtis <dalecurtis at chromium.org> wrote:

> This applies the same workaround used elsewhere in the file for handling
> overflow of addition.
>
> Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
> ---
>  libavformat/utils.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
>


More information about the ffmpeg-devel mailing list