diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-01-12 17:36:05 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-11-03 14:27:25 +0100 |
commit | 9c341c6c92a0fc9c5bbecbd12e8bdd904678e4d5 (patch) | |
tree | 155ae27aa3602d527b6e8a9dc6852f44ca75738e /doc/swscale.txt | |
parent | 2cf1eefae5dba7a7259156f9ff5c62f4e4e2fe0d (diff) | |
download | ffmpeg-9c341c6c92a0fc9c5bbecbd12e8bdd904678e4d5.tar.gz |
avformat/apngdec: Fix size/overflow checks
apng data consists of parts containing a small header (including a
four-byte size field) and a data part; the size field does not account
for everything and is actually twelve bytes short of the actual size. In
order to make sure that the size fits into an int, the size field is
checked for being > INT_MAX; yet this does not account for the + 12 and
upon conversion to int (which happens when calling append_extradata()),
the size parameter can still wrap around. In this case the currently
used check would lead to undefined signed integer overflow.
Furthermore, append_extradata() appends the new data to the already
existing extradata and therefore needs to make sure that the combined
size of new and old data as well as padding fits into an int. The check
used for this is "if (old_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE -
new_size)". If new_size is > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE
the right side becomes negative if the types are signed (as they are
now); yet changing this to "if (new_size > INT_MAX -
AV_INPUT_BUFFER_PADDING_SIZE - old_size)" is better as this also works
for unsigned types (where it is of course presumed that INT_MAX is
replaced by the corresponding maximum for the new type).
Both of these issues have been fixed.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'doc/swscale.txt')
0 files changed, 0 insertions, 0 deletions