diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-02-14 22:24:46 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-02-14 22:47:08 +0100 |
commit | 9c0b3eddf4262f9dcea479091f1307444e614e88 (patch) | |
tree | 280eda6bb997a441a7576188b55b7bc6934f4576 /libavformat | |
parent | 4f49ca7bbc75a9db4cdf93f27f95a668c751f160 (diff) | |
download | ffmpeg-9c0b3eddf4262f9dcea479091f1307444e614e88.tar.gz |
avformat/utils: Fix undefined NULL + 0
This is undefined behaviour in C, so use data = len ? data + len : data
instead of data += len. GCC optimizes the branch away in this case;
Clang unfortunately doesn't.
Fixes ticket #8592.
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 3e955b85bc..cea6d4ca92 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1426,7 +1426,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, pkt->pts = pkt->dts = AV_NOPTS_VALUE; pkt->pos = -1; /* increment read pointer */ - data += len; + data = len ? data + len : data; size -= len; got_output = !!out_pkt.size; |