summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2010-02-12 02:50:19 +0000
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2010-02-12 02:50:19 +0000
commit9fe31f395320f8b41b7cad84d7f308a3091251a3 (patch)
tree2f3729ecc0587217fdb9ebb3c8c0ef5d9ed3cf00 /src
parenta6c45d1907ff592c80d3d70f49840be384444dd4 (diff)
downloadxine-lib-9fe31f395320f8b41b7cad84d7f308a3091251a3.tar.gz
xine-lib-9fe31f395320f8b41b7cad84d7f308a3091251a3.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_qt.c6
1 files changed, 3 insertions, 3 deletions
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;