mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-21 13:36:39 +00:00
qtdemux: Handle moov atom length=0 case by reading until the end
Previously it would fail to demux the file by trying to read G_MAXUINT64 bytes. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3934>
This commit is contained in:
parent
3a9acff978
commit
4e7a5ebb11
1 changed files with 30 additions and 0 deletions
|
@ -4642,6 +4642,36 @@ gst_qtdemux_loop_state_header (GstQTDemux * qtdemux)
|
||||||
goto beach;
|
goto beach;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (length == G_MAXUINT64) {
|
||||||
|
/* Read until the end */
|
||||||
|
gint64 duration;
|
||||||
|
if (!gst_pad_peer_query_duration (qtdemux->sinkpad, GST_FORMAT_BYTES,
|
||||||
|
&duration)) {
|
||||||
|
GST_ELEMENT_ERROR (qtdemux, STREAM, DEMUX,
|
||||||
|
(_("Cannot query file size")),
|
||||||
|
("Duration query on sink pad failed"));
|
||||||
|
ret = GST_FLOW_ERROR;
|
||||||
|
goto beach;
|
||||||
|
}
|
||||||
|
if (G_UNLIKELY (cur_offset > duration)) {
|
||||||
|
GST_ELEMENT_ERROR (qtdemux, STREAM, DEMUX,
|
||||||
|
(_("Cannot query file size")),
|
||||||
|
("Duration %" G_GINT64_FORMAT " < current offset %"
|
||||||
|
G_GUINT64_FORMAT, duration, cur_offset));
|
||||||
|
ret = GST_FLOW_ERROR;
|
||||||
|
goto beach;
|
||||||
|
}
|
||||||
|
length = duration - cur_offset;
|
||||||
|
if (length > QTDEMUX_MAX_ATOM_SIZE) {
|
||||||
|
GST_ELEMENT_ERROR (qtdemux, STREAM, DEMUX,
|
||||||
|
(_("Cannot demux file")),
|
||||||
|
("Moov atom size %" G_GINT64_FORMAT " > maximum %d", length,
|
||||||
|
QTDEMUX_MAX_ATOM_SIZE));
|
||||||
|
ret = GST_FLOW_ERROR;
|
||||||
|
goto beach;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret = gst_pad_pull_range (qtdemux->sinkpad, cur_offset, length, &moov);
|
ret = gst_pad_pull_range (qtdemux->sinkpad, cur_offset, length, &moov);
|
||||||
if (ret != GST_FLOW_OK)
|
if (ret != GST_FLOW_OK)
|
||||||
goto beach;
|
goto beach;
|
||||||
|
|
Loading…
Reference in a new issue