diff mbox

[FFmpeg-devel,1/3] avformat/mpegts: add missing null pointer checks in ff_parse_mpeg2_descriptor()

Message ID 20180816133629.9352-1-michael@niedermayer.cc
State Accepted
Commit 323095a6db670041f3c98724c0e9c4a494c55bb9
Headers show

Commit Message

Michael Niedermayer Aug. 16, 2018, 1:36 p.m. UTC
Fixes: null pointer dereference
Fixes: wtv-crash-75fa58662ded1c1d349f3d1df89394fd690cf92f

Found-by: Paul Ch <paulcher@icloud.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/mpegts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Niedermayer Aug. 25, 2018, 7:49 p.m. UTC | #1
On Thu, Aug 16, 2018 at 03:36:27PM +0200, Michael Niedermayer wrote:
> Fixes: null pointer dereference
> Fixes: wtv-crash-75fa58662ded1c1d349f3d1df89394fd690cf92f
> 
> Found-by: Paul Ch <paulcher@icloud.com>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/mpegts.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

will apply

[...]
diff mbox

Patch

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index a5cb17ac16..edf6b5701d 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1983,7 +1983,7 @@  int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
                 int service_type = ((component_type & service_type_mask) >> 3);
                 if (service_type == 0x02 /* 0b010 */) {
                     st->disposition |= AV_DISPOSITION_DESCRIPTIONS;
-                    av_log(ts->stream, AV_LOG_DEBUG, "New track disposition for id %u: %u\n", st->id, st->disposition);
+                    av_log(ts ? ts->stream : fc, AV_LOG_DEBUG, "New track disposition for id %u: %u\n", st->id, st->disposition);
                 }
             }
         }
@@ -1997,7 +1997,7 @@  int ff_parse_mpeg2_descriptor(AVFormatContext *fc, AVStream *st, int stream_type
                 int service_type = ((component_type & service_type_mask) >> 3);
                 if (service_type == 0x02 /* 0b010 */) {
                     st->disposition |= AV_DISPOSITION_DESCRIPTIONS;
-                    av_log(ts->stream, AV_LOG_DEBUG, "New track disposition for id %u: %u\n", st->id, st->disposition);
+                    av_log(ts ? ts->stream : fc, AV_LOG_DEBUG, "New track disposition for id %u: %u\n", st->id, st->disposition);
                 }
             }
         }