summaryrefslogtreecommitdiff
path: root/libavformat/aviobuf.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-05-24 03:14:00 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-11 01:18:54 +0200
commit28a078eded1c29985ed078b59d48ff59cf00394b (patch)
tree7a0a7438645a67ae20e250f63c220f60d6c8787c /libavformat/aviobuf.c
parent7aa7d68971e48f6bbf729a6feb318a17010d410f (diff)
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>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r--libavformat/aviobuf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 5ba5de01c6..0e6125e161 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1287,7 +1287,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;