From 7a4e25d6e21d60c5c3f22c4498054d124d08452b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 28 Jul 2006 15:15:15 +0000 Subject: [PATCH] gst/asfdemux/: Error out when the stream is encrypted (rather than feeding garbage to the decoders). Fixes #349025. Original commit message from CVS: * gst/asfdemux/Makefile.am: * gst/asfdemux/asfheaders.c: * gst/asfdemux/asfheaders.h: * gst/asfdemux/gstasf.c: (plugin_init): * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_process_object): Error out when the stream is encrypted (rather than feeding garbage to the decoders). Fixes #349025. --- ChangeLog | 10 ++++++++++ gst/asfdemux/Makefile.am | 2 +- gst/asfdemux/asfheaders.c | 12 ++++++++++++ gst/asfdemux/asfheaders.h | 6 +++++- gst/asfdemux/gstasf.c | 8 +++++++- gst/asfdemux/gstasfdemux.c | 17 +++++++++++++++-- 6 files changed, 50 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d62805619..3f5f020079 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-07-28 Tim-Philipp Müller + + * gst/asfdemux/Makefile.am: + * gst/asfdemux/asfheaders.c: + * gst/asfdemux/asfheaders.h: + * gst/asfdemux/gstasf.c: (plugin_init): + * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_process_object): + Error out when the stream is encrypted (rather than feeding + garbage to the decoders). Fixes #349025. + 2006-07-28 Tim-Philipp Müller * Makefile.am: diff --git a/gst/asfdemux/Makefile.am b/gst/asfdemux/Makefile.am index 50777e1218..3ebd876881 100644 --- a/gst/asfdemux/Makefile.am +++ b/gst/asfdemux/Makefile.am @@ -1,7 +1,7 @@ plugin_LTLIBRARIES = libgstasf.la libgstasf_la_SOURCES = gstasfdemux.c gstasf.c asfheaders.c -libgstasf_la_CFLAGS = $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) +libgstasf_la_CFLAGS = $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) libgstasf_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(GST_BASE_LIBS) $(GST_LIBS)\ -lgstriff-@GST_MAJORMINOR@ libgstasf_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) diff --git a/gst/asfdemux/asfheaders.c b/gst/asfdemux/asfheaders.c index 3751db6462..cdcd633d4a 100644 --- a/gst/asfdemux/asfheaders.c +++ b/gst/asfdemux/asfheaders.c @@ -119,6 +119,18 @@ const ASFGuidHash asf_object_guids[] = { {ASF_OBJ_STREAM_PRIORITIZATION, "ASF_OBJ_STREAM_PRIORITIZATION", {0xd4fed15b, 0x454f88d3, 0x5cedf081, 0x249e9945} }, + {ASF_OBJ_CONTENT_ENCRYPTION, "ASF_OBJ_CONTENT_ENCRYPTION", + {0x2211b3fb, 0x11d2bd23, 0xa000b7b4, 0x6efc55c9} + }, + {ASF_OBJ_EXT_CONTENT_ENCRYPTION, "ASF_OBJ_EXT_CONTENT_ENCRYPTION", + {0x298ae614, 0x4c172622, 0xe0da35b9, 0x9c28e97e} + }, + {ASF_OBJ_DIGITAL_SIGNATURE_OBJECT, "ASF_OBJ_DIGITAL_SIGNATURE_OBJECT", + {0x2211b3fc, 0x11d2bd23, 0xa000b7b4, 0x6efc55c9} + }, + {ASF_OBJ_SCRIPT_COMMAND, "ASF_OBJ_SCRIPT_COMMAND", + {0x1efb1a30, 0x11d00b62, 0xa0009ba3, 0xf64803c9} + }, {ASF_OBJ_UNDEFINED, "ASF_OBJ_UNDEFINED", {0, 0, 0, 0} } diff --git a/gst/asfdemux/asfheaders.h b/gst/asfdemux/asfheaders.h index c68e980ed1..28ca7434fb 100644 --- a/gst/asfdemux/asfheaders.h +++ b/gst/asfdemux/asfheaders.h @@ -59,7 +59,11 @@ enum { ASF_OBJ_INDEX_PLACEHOLDER, ASF_OBJ_INDEX_PARAMETERS, ASF_OBJ_ADVANCED_MUTUAL_EXCLUSION, - ASF_OBJ_STREAM_PRIORITIZATION + ASF_OBJ_STREAM_PRIORITIZATION, + ASF_OBJ_CONTENT_ENCRYPTION, + ASF_OBJ_EXT_CONTENT_ENCRYPTION, + ASF_OBJ_DIGITAL_SIGNATURE_OBJECT, + ASF_OBJ_SCRIPT_COMMAND }; enum { diff --git a/gst/asfdemux/gstasf.c b/gst/asfdemux/gstasf.c index fda5181237..e7dcaec0f8 100644 --- a/gst/asfdemux/gstasf.c +++ b/gst/asfdemux/gstasf.c @@ -22,7 +22,8 @@ #endif #include -#include +#include +#include "gst/gst-i18n-plugin.h" #include "gstasfdemux.h" /* #include "gstasfmux.h" */ @@ -30,6 +31,11 @@ static gboolean plugin_init (GstPlugin * plugin) { +#ifdef ENABLE_NLS + setlocale (LC_ALL, ""); + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); +#endif /* ENABLE_NLS */ + gst_riff_init (); if (!gst_element_register (plugin, "asfdemux", GST_RANK_SECONDARY, diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c index fcbf56bd39..1175cb3fa9 100644 --- a/gst/asfdemux/gstasfdemux.c +++ b/gst/asfdemux/gstasfdemux.c @@ -25,6 +25,7 @@ #include #include +#include "gst/gst-i18n-plugin.h" #include #include "gstasfdemux.h" @@ -935,7 +936,7 @@ gst_asf_demux_add_audio_stream (GstASFDemux * demux, gst_asf_demux_setup_pad (demux, src_pad, caps, id, FALSE, tags); } -static gboolean +static void gst_asf_demux_add_video_stream (GstASFDemux * demux, asf_stream_video_format * video, guint16 id, guint8 ** p_data, guint64 * p_size) @@ -1832,7 +1833,6 @@ gst_asf_demux_process_object (GstASFDemux * demux, guint8 ** p_data, GstFlowReturn ret; guint32 obj_id; guint64 obj_size, obj_data_size; - gint64 processed; if (!gst_asf_demux_get_object_header (demux, &obj_id, &obj_size, p_data, p_size)) { @@ -1887,6 +1887,10 @@ gst_asf_demux_process_object (GstASFDemux * demux, guint8 ** p_data, case ASF_OBJ_LANGUAGE_LIST: ret = gst_asf_demux_process_language_list (demux, p_data, p_size); break; + case ASF_OBJ_CONTENT_ENCRYPTION: + case ASF_OBJ_EXT_CONTENT_ENCRYPTION: + case ASF_OBJ_DIGITAL_SIGNATURE_OBJECT: + goto error_encrypted; case ASF_OBJ_CONCEAL_NONE: case ASF_OBJ_HEAD2: case ASF_OBJ_UNDEFINED: @@ -1900,6 +1904,7 @@ gst_asf_demux_process_object (GstASFDemux * demux, guint8 ** p_data, case ASF_OBJ_INDEX_PARAMETERS: case ASF_OBJ_ADVANCED_MUTUAL_EXCLUSION: case ASF_OBJ_STREAM_PRIORITIZATION: + case ASF_OBJ_SCRIPT_COMMAND: default: /* Unknown/unhandled object read. Just ignore * it, people don't like fatal errors much */ @@ -1918,6 +1923,14 @@ gst_asf_demux_process_object (GstASFDemux * demux, guint8 ** p_data, gst_asf_demux_pop_obj (demux); return ret; + +/* ERRORS */ +error_encrypted: + { + GST_ELEMENT_ERROR (demux, STREAM, DECODE, + (_("This file is encrypted and cannot be played.")), (NULL)); + return GST_FLOW_ERROR; + } } static void