removed an uninitialized data error popped by valgrind on PE references

* parser.c: removed an uninitialized data error popped by valgrind
  on PE references
Daniel
diff --git a/ChangeLog b/ChangeLog
index c2031b1..b20c98e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun 13 17:30:25 CEST 2002 Daniel Veillard <daniel@veillard.com>
+
+	* parser.c: removed an uninitialized data error popped by valgrind
+	  on PE references
+
 Wed Jun 12 21:38:46 MDT 2002 John Fleck <jfleck@inkstain.net>
 
 	* doc/xml.html
diff --git a/parser.c b/parser.c
index f5827e0..fa0dd4a 100644
--- a/parser.c
+++ b/parser.c
@@ -899,13 +899,15 @@
 		     * plug some encoding conversion routines.
 		     */
 		    GROW
-		    start[0] = RAW;
-		    start[1] = NXT(1);
-		    start[2] = NXT(2);
-		    start[3] = NXT(3);
-		    enc = xmlDetectCharEncoding(start, 4);
-		    if (enc != XML_CHAR_ENCODING_NONE) {
-			xmlSwitchEncoding(ctxt, enc);
+	            if (entity->length >= 4) {
+			start[0] = RAW;
+			start[1] = NXT(1);
+			start[2] = NXT(2);
+			start[3] = NXT(3);
+			enc = xmlDetectCharEncoding(start, 4);
+			if (enc != XML_CHAR_ENCODING_NONE) {
+			    xmlSwitchEncoding(ctxt, enc);
+			}
 		    }
 
 		    if ((entity->etype == XML_EXTERNAL_PARAMETER_ENTITY) &&