[vlc-commits] XML: throw an error if HTML subtitles have no root node

Pierre Ynard git at videolan.org
Fri Jan 21 18:48:18 CET 2011


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Fri Jan 21 18:47:07 2011 +0100| [ba00f4c040b1e7745e9b90085a511246169960f2] | committer: Pierre Ynard

XML: throw an error if HTML subtitles have no root node

This shouldn't happen unless the codec is buggy

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ba00f4c040b1e7745e9b90085a511246169960f2
---

 modules/misc/freetype.c   |   13 +++++++++++--
 modules/misc/quartztext.c |   15 +++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c
index 87e4146..73b27a4 100644
--- a/modules/misc/freetype.c
+++ b/modules/misc/freetype.c
@@ -2181,11 +2181,20 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out,
                 /* Only text and karaoke tags are supported */
                 msg_Dbg( p_filter, "Unsupported top-level tag <%s> ignored.",
                          node );
-                p_filter->p_sys->p_xml = xml_ReaderReset( p_xml_reader, NULL );
-                p_xml_reader = NULL;
                 rv = VLC_EGENERIC;
             }
         }
+        else
+        {
+            msg_Err( p_filter, "Malformed HTML subtitle" );
+            rv = VLC_EGENERIC;
+        }
+
+        if( rv != VLC_SUCCESS )
+        {
+            p_filter->p_sys->p_xml = xml_ReaderReset( p_xml_reader, NULL );
+            p_xml_reader = NULL;
+        }
     }
 
     if( p_xml_reader )
diff --git a/modules/misc/quartztext.c b/modules/misc/quartztext.c
index f8277dc..e9790f0 100644
--- a/modules/misc/quartztext.c
+++ b/modules/misc/quartztext.c
@@ -833,11 +833,22 @@ static int RenderHtml( filter_t *p_filter, subpicture_region_t *p_region_out,
                     else
                     {
                         /* Only text and karaoke tags are supported */
-                        xml_ReaderDelete( p_xml_reader );
-                        p_xml_reader = NULL;
+                        msg_Dbg( p_filter, "Unsupported top-level tag "
+                                           "<%s> ignored.", name );
                         rv = VLC_EGENERIC;
                     }
                 }
+                else
+                {
+                    msg_Err( p_filter, "Malformed HTML subtitle" );
+                    rv = VLC_EGENERIC;
+                }
+
+                if( rv != VLC_SUCCESS )
+                {
+                    xml_ReaderDelete( p_xml_reader );
+                    p_xml_reader = NULL;
+                }
             }
 
             if( p_xml_reader )



More information about the vlc-commits mailing list