mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-20 07:48:15 +02:00
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>
This commit is contained in:
parent
8e12af29d1
commit
b6546add07
@ -1275,7 +1275,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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user