mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
cafdec: fix overflow checking in read_header()
Several compilers such as clang/icc/pathscale will optimize the check pos + size < pos (assuming size > 0) into false, since signed integer overflow is undefined behavior in C. This breaks overflow checking. Use a safe precondition check instead. Signed-off-by: Xi Wang <xi.wang@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
3317414fc1
commit
64b7e7dcaf
@ -300,7 +300,7 @@ static int read_header(AVFormatContext *s)
|
||||
}
|
||||
|
||||
if (size > 0) {
|
||||
if (pos + size < pos)
|
||||
if (pos > INT64_MAX - size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_skip(pb, FFMAX(0, pos + size - avio_tell(pb)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user