apetag: Fix APE tag size check
The size variable is (correctly) unsigned, but is passed to several functions
which take signed parameters, such as avio_read, sometimes after having
numbers added to it. So ensure that size remains within the bounds that
these functions can handle.
CC: libav-stable@libav.org
Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit c5560e72d0
)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:

committed by
Michael Niedermayer

parent
beb83f0a40
commit
47fe68eec8
@@ -53,8 +53,10 @@ static int ape_tag_read_field(AVFormatContext *s)
|
|||||||
av_log(s, AV_LOG_WARNING, "Invalid APE tag key '%s'.\n", key);
|
av_log(s, AV_LOG_WARNING, "Invalid APE tag key '%s'.\n", key);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (size >= UINT_MAX)
|
if (size > INT32_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
|
||||||
return -1;
|
av_log(s, AV_LOG_ERROR, "APE tag size too large.\n");
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
if (flags & APE_TAG_FLAG_IS_BINARY) {
|
if (flags & APE_TAG_FLAG_IS_BINARY) {
|
||||||
uint8_t filename[1024];
|
uint8_t filename[1024];
|
||||||
enum AVCodecID id;
|
enum AVCodecID id;
|
||||||
|
Reference in New Issue
Block a user