fixed problem with comments reported by Nick Kew added routines

* HTMLparser.c: fixed problem with comments reported by Nick Kew
* encoding.c: added routines xmlUTF8Size and xmlUTF8Charcmp for
  some future cleanup of UTF8 handling
diff --git a/HTMLparser.c b/HTMLparser.c
index e7dcb34..2ee458c 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -4358,10 +4358,11 @@
 		(buf[base + 2] == '-') && (buf[base + 3] == '-')) {
 		incomment = 1;
 	    }
-	    /* do not increment base, some people use <!--> */
+	    /* do not increment past <!, some people use <!--> */
+	    base += 2;
 	}
 	if (incomment) {
-	    if (base + 3 < len)
+	    if (base + 3 > len)
 		return(-1);
 	    if ((buf[base] == '-') && (buf[base + 1] == '-') &&
 		(buf[base + 2] == '>')) {