]> granicus.if.org Git - libexpat/commitdiff
Comment change: exclude unreachable case in prolog1
authorRhodri James <rhodri@kynesim.co.uk>
Tue, 20 Jun 2017 12:48:40 +0000 (13:48 +0100)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 22 Jul 2017 20:49:21 +0000 (22:49 +0200)
expat/lib/xmlrole.c

index a7c56302796957af60020ac9aa981830b5fd409b..18d7a51af441f1db28dd9672e8d08bf29cf2e293 100644 (file)
@@ -170,7 +170,14 @@ prolog1(PROLOG_STATE *state,
   case XML_TOK_COMMENT:
     return XML_ROLE_COMMENT;
   case XML_TOK_BOM:
-    return XML_ROLE_NONE;
+    /* This case can never arise.  To reach this role function, the
+     * parse must have passed through prolog0 and therefore have had
+     * some form of input, even if only a space.  At that point, a
+     * byte order mark is no longer a valid character (though
+     * technically it should be interpreted as a non-breaking space),
+     * so will be rejected by the tokenizing stages.
+     */
+    return XML_ROLE_NONE; /* LCOV_EXCL_LINE */
   case XML_TOK_DECL_OPEN:
     if (!XmlNameMatchesAscii(enc,
                              ptr + 2 * MIN_BYTES_PER_CHAR(enc),