Commit 2750558c authored by Filip Roséen's avatar Filip Roséen Committed by François Cartegnie

demux/mp4: store length of payload in MP4_Box_data_string_t

MP4_ReadBox_String is invoked for boxes that contains raw
byte-content, though there is nothing saying that this raw-byte
sequence does not contain a null-byte ('\0').

If the sequence contains a null-byte, then there is no way (in the
previous implementation) for things working with the box-content to
access data that follows it (given that one cannot know if the
null-byte is the end-of-data terminator, or simply part of the

These changes make sure that the entire contents can be accessed by
including the length of the contents in MP4_Box_data_string_t.
Signed-off-by: François Cartegnie's avatarFrancois Cartegnie <>
parent 57ff4212
......@@ -3327,6 +3327,7 @@ static int MP4_ReadBox_String( stream_t *p_stream, MP4_Box_t *p_box )
if( p_box->i_size < 8 || p_box->i_size > SIZE_MAX )
p_box->data.p_string->i_length = i_read;
p_box->data.p_string->psz_text = malloc( p_box->i_size + 1 - 8 ); /* +\0, -name, -size */
if( p_box->data.p_string->psz_text == NULL )
......@@ -1176,6 +1176,7 @@ typedef struct
typedef struct
char *psz_text;
uint64_t i_length;
} MP4_Box_data_string_t;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment