diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-07-08 19:12:26 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-07-08 20:11:20 +0200 |
commit | 9ffac78eba3887f2d7c113937162607d05180e0c (patch) | |
tree | a1a4c3b87c04938567ee10e67796efeb7fcd7007 /doc/examples/vaapi_encode.c | |
parent | 8765b36a526ba1e9698e060f9bcd646f3dfeeaf4 (diff) | |
download | ffmpeg-9ffac78eba3887f2d7c113937162607d05180e0c.tar.gz |
avformat/matroskaenc: Fix and simplify check for invalid crop values
The check "left >= INT_MAX - right" is supposed to check for
whether left + right does not overflow/wraparound, but given that
left and top are uint32_t INT_MAX - right can already wraparound
for big values of right (and ordinary 32-bit ints):
If right == UINT32_MAX, INT_MAX - right is INT_MAX + 1;
for left in 0..par->width both checks will be passed.
Fix this and simplify the check by using 64-bit types,
where the addition is guaranteed not to overflow.
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'doc/examples/vaapi_encode.c')
0 files changed, 0 insertions, 0 deletions