gst/typefind/gsttypefindfunctions.c: Limit search for the first markup tag to the...
authorTim-Philipp Müller <tim@centricular.net>
Sat, 22 Jul 2006 17:01:12 +0000 (17:01 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Sat, 22 Jul 2006 17:01:12 +0000 (17:01 +0000)
Original commit message from CVS:
* gst/typefind/gsttypefindfunctions.c: (xml_check_first_element):
Limit search for the first markup tag to the first few kB of
the file. If we don't find one there, it's highly unlikely that
this is an XML(-ish) file.

ChangeLog
gst/typefind/gsttypefindfunctions.c

index 9b6c75b..95c326b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-07-22  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * gst/typefind/gsttypefindfunctions.c: (xml_check_first_element):
+         Limit search for the first markup tag to the first few kB of
+         the file. If we don't find one there, it's highly unlikely that
+         this is an XML(-ish) file.
+
 2006-07-21  Andy Wingo  <wingo@pobox.com>
 
        * tests/check/pipelines/theoraenc.c (test_discontinuity): Similar
index c8fd9d4..3b305df 100644 (file)
@@ -225,9 +225,10 @@ xml_check_first_element (GstTypeFind * tf, const gchar * element, guint elen,
     data += 5;
   }
 
-  /* look for the first element, it has to be the requested element */
-  while (data) {
-    while (*data != '<') {
+  /* look for the first element, it has to be the requested element. Bail
+   * out if it is not within the first 4kB. */
+  while (data && (offset + pos) < 4096) {
+    while (*data != '<' && (offset + pos) < 4096) {
       XML_INC_BUFFER;
     }