Commit graph

23 commits

Author SHA1 Message Date
Sebastian Dröge 14d306da6d qtdemux: Fix integer overflows in zlib decompression code
Various variables were of smaller types than needed and there were no
checks for any overflows when doing additions on the sizes. This is all
checked now.

In addition the size of the decompressed data is limited to 200MB now as
any larger sizes are likely pathological and we can avoid out of memory
situations in many cases like this.

Also fix a bug where the available output size on the next iteration in
the zlib decompression code was provided too large and could
potentially lead to out of bound writes.

Thanks to Adam Doupe for analyzing and reporting the issue.

CVE: tbd

https://gstreamer.freedesktop.org/security/sa-2022-0003.html

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1225

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2610>
2022-06-15 17:50:55 +00:00
Sebastian Dröge 7273024ae5 qtdemux: Add support for ONVIF XML Timed MetaData
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2453>
2022-05-20 13:01:44 +00:00
Sebastian Dröge 04f6258863 qtdemux: Parse styp box for informational purposes
And include some more details in the debug logs for the ftyp box too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2453>
2022-05-20 13:01:44 +00:00
Sebastian Dröge 1223324246 qtdemux: Don't use tfdt for parsing subsequent trun boxes
The timestamp in the tfdt refers to the first trun box and if there are
multiple trun boxes then the distance between the first timestamps will
grow.

At some point this distance reaches a threshold and triggers the
resetting of the first sample's timestamp of this trun box to be reset
to the tfdt.

This threshold is implemented for files where there is a jump in the
timeline between fragments and where this can be detected via a jump
between the end timestamp of the previous fragment and the tfdt of the
next. This behaviour is preserved.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2409>
2022-05-13 04:19:36 +00:00
Xavier Claessens b99ecc78ca Replace gst-i18n-*.h with gi18n-lib.h
GLib guarantees libintl is always present, using proxy-libintl as
last resort. There is no need to mock gettex API any more.

This fix static build on Windows because G_INTL_STATIC_COMPILATION must
be defined before including libintl.h, and glib does it for us as part
as including glib.h.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2028>
2022-04-19 18:01:06 +00:00
Havard Graff 71891e5647 qtdemux: fix leak of channel_mapping
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2179>
2022-04-14 19:41:36 +09:00
Edward Hervey 568b918971 qtdemux: Propagate stick events downstream when creating pads
If upstream provided a stream collection event before any pads were created,
make sure it's propagated downstream when pads are created.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1891>
2022-03-09 16:09:31 +00:00
Nicolas Dufresne f6c070fbff isomp4: Fix AV1 default alignment
ISOMP4 store TU (temporal units) worth of AV1. Expose this in the
caps to reduce overhead in the parser, and in the muxer to avoid
storing frames split in the wrong way.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1837>
2022-03-04 21:58:15 +00:00
Seungha Yang 53ed876002 qtdemux: Do not send unnecessary GAP events
Each stream may have its own segment timeline
(i.g., different segment.start or segment.base)
depending on edit-list and composition-to-decode atom.

Make sure whether time position of a stream has been actually
far behind than that of current target stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1352>
2022-02-17 19:39:53 +00:00
Sebastian Dröge efb2b6d478 qtdemux: Log cslg_shift that was determined
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>
2021-11-12 17:51:04 +00:00
Sebastian Dröge 12e918428a qtdemux: Use a composition time offset of 0 for "no decode samples" for the time being
This needs codec-specific handling, but using 0 instead of G_MININT32 at
least gives somewhat reasonable behaviour.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/883

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>
2021-11-12 17:51:03 +00:00
Sebastian Dröge ad412d257b qtdemux: Always check ctts for unreasonably large offsets
If this happens then ignore the whole ctts. Previously we only did this
if the PTS/DTS shift was determined from the ctts instead of the cslg.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>
2021-11-12 17:51:03 +00:00
Sebastian Dröge a33e30cfc4 qtdemux: Only adjust segment.stop by cslg_shift if stop is not -1
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>
2021-11-12 17:51:03 +00:00
Sebastian Dröge bb5a5ae8a8 qtdemux: Handle negative composition offsets in the trun box the same way as for non-fragmented streams
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>
2021-11-12 17:51:03 +00:00
Sebastian Dröge 767e8bf668 qtdemux: Parse ctts version
Negative composition time offsets are only allowed with version 1 of the
box, however we parse it as a signed value also for version 0 boxes as
unfortunately there are such files out there and it's unlikely to have
(valid) huge composition offsets.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>
2021-11-12 17:51:03 +00:00
Sebastian Dröge 284dd5443f qtdemux: Add support for version 1 cslg boxes
They use 64 bit fields instead of 32 bit.

Also parse offset as a signed integer (in both versions) and clamp it to
a positive value as negative values don't really interest us here.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>
2021-11-12 17:51:03 +00:00
Sebastian Dröge 7f105a919a qtdemux: Don't free cslg data that we don't own on corrupt files
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1294>
2021-11-12 17:51:03 +00:00
Zhao, Gang 6cad2a7150 qtdemux: Fix can not demux Opus track made by qtmux
Opus stream info is read from dOps box [1]. The offset of dOps box in Opus box is different in mp4a version 1 and 0 [2]. Calculate the offset of dOps box according to mp4a version.

[1] https://opus-codec.org/docs/opus_in_isobmff.html

[2] subprojects/gst-plugins-good/gst/isomp4/atoms.c:sample_entry_mp4a_copy_data:2146

Fixed: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/918
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1329>
2021-11-09 17:57:49 +00:00
Jan Schmidt f6ed40c93a qtdemux: Fix text and closed-caption handling.
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1182
broke text and and closed caption extraction when introducing WebVTT
support, by making the output buffers not have timestamps any more.

Fix that by making the process functions copy buffer metadata
when generating new output buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1262>
2021-10-28 21:45:33 +11:00
Jan Schmidt 6cada5b064 qtdemux: Add support for wvtt (WebVTT) subtitles.
WebVTT in ISO MP4 is specified in ISO 14496-30,
and needed for DASH support. It's stored in an
mp4 specific format. To handle it compatibly,
the wvtt boxes are converted back into WebVTT text
and pushed as application/x-subtitle-vtt

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1182>
2021-10-19 08:56:58 +00:00
Jan Schmidt 41d6f47f2b isomp4: Split buffer process functions.
Split the different handling for closed captions, VobSub subpicture
and timed text samples into separate simplified process functions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1182>
2021-10-19 08:56:58 +00:00
Jan Schmidt c47c6b4c2b isomp4: Use a function pointer for buffer splitting.
Swap the `need_process` boolean check on qtdemux streams
for a direct function pointer to the splitting function,
so we can stop adding extra cases to the single growing
`gst_qtdemux_process_buffer()` function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1182>
2021-10-19 08:56:58 +00:00
Thibault Saunier 5ff769d731 Move files from gst-plugins-good into the "subprojects/gst-plugins-good/" subdir 2021-09-24 16:13:50 -03:00
Renamed from gst/isomp4/qtdemux.c (Browse further)