diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-03-14 04:03:19 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2023-06-20 16:15:08 +0200 |
commit | 43991dbd0557cd4142e90d0d9698c7678cee60b6 (patch) | |
tree | 9d5a3d1a55c0fa1ce22f7ce8b35137f40e926733 | |
parent | 8e53233f68a441cb4f1177bc3c237768830ac58e (diff) | |
download | ffmpeg-43991dbd0557cd4142e90d0d9698c7678cee60b6.tar.gz |
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@outlook.com>
-rw-r--r-- | libavformat/assenc.c | 4 |
1 files 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; |