gst/qtdemux/qtdemux.c: Some 'broken' files out there have atom lengths of zero... which basically results in qtdemux ...

Original commit message from CVS:
* gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_state_header),
(gst_qtdemux_chain):
Some 'broken' files out there have atom lengths of zero...
which basically results in qtdemux consuming that atom again and again
until the *end of night* !
Detect that and emits an adequate element error message.
This commit is contained in:
Edward Hervey 2008-09-17 14:50:42 +00:00
parent a236a2df36
commit 53a576bb6f
2 changed files with 26 additions and 0 deletions

View file

@ -1,3 +1,12 @@
2008-09-17 Edward Hervey <edward.hervey@collabora.co.uk>
* gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_state_header),
(gst_qtdemux_chain):
Some 'broken' files out there have atom lengths of zero...
which basically results in qtdemux consuming that atom again and again
until the *end of night* !
Detect that and emits an adequate element error message.
2008-09-17 Jan Schmidt <jan.schmidt@sun.com>
* gst/interleave/Makefile.am:

View file

@ -1089,6 +1089,15 @@ gst_qtdemux_loop_state_header (GstQTDemux * qtdemux)
extract_initial_length_and_fourcc (GST_BUFFER_DATA (buf), &length, &fourcc);
gst_buffer_unref (buf);
if (length == 0) {
GST_ELEMENT_ERROR (qtdemux, STREAM, DECODE,
(_("This file is invalid and cannot be played.")),
("Header atom '%" GST_FOURCC_FORMAT "' has empty length",
GST_FOURCC_ARGS (fourcc)));
ret = GST_FLOW_ERROR;
goto beach;
}
switch (fourcc) {
case FOURCC_mdat:
case FOURCC_free:
@ -2092,6 +2101,14 @@ gst_qtdemux_chain (GstPad * sinkpad, GstBuffer * inbuf)
GST_DEBUG_OBJECT (demux,
"Peeking found [%" GST_FOURCC_FORMAT "] size: %u",
GST_FOURCC_ARGS (fourcc), (guint) size);
if (size == 0) {
GST_ELEMENT_ERROR (demux, STREAM, DECODE,
(_("This file is invalid and cannot be played.")),
("initial atom '%" GST_FOURCC_FORMAT "' has empty length",
GST_FOURCC_ARGS (fourcc)));
ret = GST_FLOW_ERROR;
break;
}
if (fourcc == FOURCC_mdat) {
if (demux->n_streams > 0) {
demux->state = QTDEMUX_STATE_MOVIE;