[FFmpeg-cvslog] avformat/assenc: Fix potential NULL + 1
Andreas Rheinhardt
git at videolan.org
Tue Jun 20 17:34:14 EEST 2023
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Mar 14 04:03:19 2023 +0100| [43991dbd0557cd4142e90d0d9698c7678cee60b6] | committer: Andreas Rheinhardt
avformat/assenc: Fix potential NULL + 1
Incrementing a NULL pointer is undefined behaviour,
yet this is what would happen in case trailer were NULL
before the check.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=43991dbd0557cd4142e90d0d9698c7678cee60b6
---
libavformat/assenc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/assenc.c b/libavformat/assenc.c
index 6ecfb04517..62ea0745a4 100644
--- a/libavformat/assenc.c
+++ b/libavformat/assenc.c
@@ -63,8 +63,8 @@ static int write_header(AVFormatContext *s)
if (trailer)
trailer = strstr(trailer, "\n");
- if (trailer++) {
- header_size = (trailer - par->extradata);
+ if (trailer) {
+ header_size = (++trailer - par->extradata);
ass->trailer_size = par->extradata_size - header_size;
if (ass->trailer_size)
ass->trailer = trailer;
More information about the ffmpeg-cvslog
mailing list