diff options
author | Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> | 2016-01-05 13:05:50 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-01-07 08:20:21 +0100 |
commit | fa463aa83a4920b0eed47ad1f79775dfc53d21ec (patch) | |
tree | 4a32cb244b819c4041020a20f67d9c6c4004f184 /libavcodec/avpacket.c | |
parent | 066281372d90d63ca021b659abcb8faefd6bc4a6 (diff) | |
download | ffmpeg-fa463aa83a4920b0eed47ad1f79775dfc53d21ec.tar.gz |
avpacket: fix size check in packet_alloc
The previous check only caught sizes from -AV_INPUT_BUFFER_PADDING_SIZE
to -1.
This fixes ubsan runtime error: signed integer overflow: 2147483647 + 32
cannot be represented in type 'int'
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/avpacket.c')
-rw-r--r-- | libavcodec/avpacket.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 87454d5647..3f8e163467 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -69,7 +69,7 @@ void av_packet_free(AVPacket **pkt) static int packet_alloc(AVBufferRef **buf, int size) { int ret; - if ((unsigned)size >= (unsigned)size + AV_INPUT_BUFFER_PADDING_SIZE) + if (size < 0 || size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) return AVERROR(EINVAL); ret = av_buffer_realloc(buf, size + AV_INPUT_BUFFER_PADDING_SIZE); |