diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-05-24 03:14:00 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-07-01 21:32:50 +0200 |
commit | 2b2358f595523ab916d1e437d52e01f463afcc00 (patch) | |
tree | a5f3550f4cf9eaf23357b879e56bb57d54c83915 | |
parent | 5daaa64d8ae1b6d95c99998dbdf19e9d94f0abe0 (diff) | |
download | ffmpeg-2b2358f595523ab916d1e437d52e01f463afcc00.tar.gz |
avformat/aviobuf: Don't check for overflow after it happened
If adding two ints overflows, it doesn't matter whether the result will
be stored in an unsigned or not; and checking afterwards does not make it
retroactively defined.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit 28a078eded1c29985ed078b59d48ff59cf00394b)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r-- | libavformat/aviobuf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index de9f210d2d..6836e0c79e 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -1305,7 +1305,7 @@ static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size) unsigned new_size, new_allocated_size; /* reallocate buffer if needed */ - new_size = d->pos + buf_size; + new_size = (unsigned)d->pos + buf_size; new_allocated_size = d->allocated_size; if (new_size < d->pos || new_size > INT_MAX/2) return -1; |