From 9fe31f395320f8b41b7cad84d7f308a3091251a3 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Fri, 12 Feb 2010 02:50:19 +0000 Subject: Clip the atom size to that remaining *before* testing whether it's too small. This fixes a segfault which may occur when playing an MPEG4 stream. --- src/demuxers/demux_qt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c index 30deea59f..9ba70ebbb 100644 --- a/src/demuxers/demux_qt.c +++ b/src/demuxers/demux_qt.c @@ -736,12 +736,12 @@ static char *parse_data_atom(const uint8_t *data_atom, uint32_t max_size) { static const int data_atom_max_version = 0; const int data_atom_version = data_atom[8]; - if (data_atom_size < 8) - return NULL; /* too small */ - if (data_atom_size > max_size) data_atom_size = max_size; + if (data_atom_size < 8) + return NULL; /* too small */ + const size_t alloc_size = data_atom_size - 8 + 1; char *alloc_str = NULL; -- cgit v1.2.3