Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gst-plugins-good.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJustin Chadwell <justin.chadwell@pexip.com>2020-07-13 12:37:19 +0300
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-07-15 15:10:45 +0300
commite6f66f46818f61e8cd111c9f951955d12bc19c54 (patch)
treebde3af66b359be3791b59d42cdb9914eb9d0fe58 /tests
parentd3cbd4077eb453d2b2959ee66c2e784bc6097c7d (diff)
qtdemux: fix crashes when input stream contained no stsd entries
During trak parsing, we need to check for the existence of stsd_entries, otherwise, we end up with a NULL pointer to them. It is entirely possible for the stsd to exist, but for it to have no entries, which the previous checks did not take into account. This patch adds a simply check to ensure that all files that do not contain a stsd entry are deemed corrupt, and adds a test case to prevent a regression. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/670>
Diffstat (limited to 'tests')
-rw-r--r--tests/check/elements/qtdemux.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/check/elements/qtdemux.c b/tests/check/elements/qtdemux.c
index 44aa9b45c..cd9dc6950 100644
--- a/tests/check/elements/qtdemux.c
+++ b/tests/check/elements/qtdemux.c
@@ -22,6 +22,7 @@
#include "qtdemux.h"
#include <glib/gprintf.h>
+#include <gst/check/gstharness.h>
typedef struct
{
@@ -72,6 +73,56 @@ qtdemux_pad_added_cb (GstElement * element, GstPad * pad, CommonTestData * data)
(GstPadProbeCallback) qtdemux_probe, data, NULL);
}
+GST_START_TEST (test_qtdemux_fuzzed0)
+{
+ GstHarness *h;
+ GstBuffer *buf;
+ guchar *fuzzed_qtdemux;
+ gsize fuzzed_qtdemux_len;
+
+ /* The goal of this test is to check that qtdemux can properly handle
+ * a stream that does not contain any stsd entries, by correctly identifying
+ * the case and erroring out appropriately.
+ */
+
+ h = gst_harness_new_parse ("qtdemux");
+ gst_harness_set_src_ca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AAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
+ "AAAAAAAAAAAY//8AAAAjYXZjQwFCwAz/4QAMZ0LADJWhCSAeEQjUAQAEaM48gAAAABRidHJ0AAAA"
+ "AAAAAAAAAAYIAAAAE2NvbHJuY2x4AAYAAQAGAAAAABBwYXNwAAAAAQAAAAEAAAAYc3R0cwAAAAAA"
+ "AAABAAAABQAAAAAAAAAUc3RzcwAAAAAAAAABAAAAAQAAABxzdHNjAAAAAAAAAAEAAAABAAAABQAA"
+ "AAEAAAAoc3RzegAAAAAAAAAAAAAAAQAAAAAAAAAWAAAAWgAAAAoAAAAKAAAAFHN0Y28AAAAAAAAA"
+ "AQAAADAAAAA9dWR0YQAAADVtZXRhAAAAAAAAACFoZGxyAAAAAG1obJJtZGlyAAAAAAAAAAAAAAAA"
+ "AAAAAAhpbHN0AAAAPXVkdGEAAAA1bWV0YQAAAAAAAAAhaGRscgAAAABtaGxybWRpcgAAAAAAAAAA"
+ "AAAAAAAAAAAIaWxzdA==", &fuzzed_qtdemux_len);
+
+ buf = gst_buffer_new_and_alloc (fuzzed_qtdemux_len);
+ gst_buffer_fill (buf, 0, fuzzed_qtdemux, fuzzed_qtdemux_len);
+ fail_unless_equals_int (gst_harness_push (h, buf), GST_FLOW_OK);
+
+ fail_unless (gst_harness_buffers_received (h) == 0);
+
+ g_free (fuzzed_qtdemux);
+ gst_harness_teardown (h);
+}
+
+GST_END_TEST;
+
GST_START_TEST (test_qtdemux_input_gap)
{
GstElement *qtdemux;
@@ -646,6 +697,7 @@ qtdemux_suite (void)
TCase *tc_chain = tcase_create ("general");
suite_add_tcase (s, tc_chain);
+ tcase_add_test (tc_chain, test_qtdemux_fuzzed0);
tcase_add_test (tc_chain, test_qtdemux_input_gap);
tcase_add_test (tc_chain, test_qtdemux_duplicated_moov);
tcase_add_test (tc_chain, test_qtdemux_stream_change);