summaryrefslogtreecommitdiff
path: root/libavformat/assenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-03-14 04:03:19 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2023-06-20 16:15:08 +0200
commit43991dbd0557cd4142e90d0d9698c7678cee60b6 (patch)
tree9d5a3d1a55c0fa1ce22f7ce8b35137f40e926733 /libavformat/assenc.c
parent8e53233f68a441cb4f1177bc3c237768830ac58e (diff)
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>
Diffstat (limited to 'libavformat/assenc.c')
-rw-r--r--libavformat/assenc.c4
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;