[FFmpeg-cvslog] avformat/utils: Fix undefined NULL + 0
Andreas Rheinhardt
git at videolan.org
Mon Feb 15 00:20:40 EET 2021
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Sun Feb 14 22:24:46 2021 +0100| [9c0b3eddf4262f9dcea479091f1307444e614e88] | committer: Andreas Rheinhardt
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 at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9c0b3eddf4262f9dcea479091f1307444e614e88
---
libavformat/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
More information about the ffmpeg-cvslog
mailing list