From 61c17c5665a05d9c68627ecda407f9ffc9719d50 Mon Sep 17 00:00:00 2001 From: Jacek Skiba Date: Wed, 7 Dec 2022 09:47:49 +0100 Subject: [PATCH] qtdemux: exit when protection caps are not defined during PIFF parsing Reproduction testcase (uses PlayReady): https://developers.canal-plus.com/rx-player/upc/?appTileLocation=[object%20Object] In test streams we are using PIFF box, but caps did not had present GST_PROTECTION_SYSTEM_ID_CAPS_FIELD. In consequence, invalid system_id was returned which caused SIGSEGV crash. Part-of: --- subprojects/gst-plugins-good/gst/isomp4/qtdemux.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c index 4e651b2380..2d1887a7c9 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c +++ b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c @@ -2843,8 +2843,13 @@ qtdemux_parse_piff (GstQTDemux * qtdemux, const guint8 * buffer, gint length, return; } - gst_structure_get (structure, GST_PROTECTION_SYSTEM_ID_CAPS_FIELD, - G_TYPE_STRING, &system_id, NULL); + if (!gst_structure_get (structure, GST_PROTECTION_SYSTEM_ID_CAPS_FIELD, + G_TYPE_STRING, &system_id, NULL)) { + GST_WARNING_OBJECT (qtdemux, "%s field not present in caps", + GST_PROTECTION_SYSTEM_ID_CAPS_FIELD); + return; + } + gst_qtdemux_append_protection_system_id (qtdemux, system_id); stream->protected = TRUE;