Browse Source

2006-09-21 Atsushi Enomoto <[email protected]>

	* XmlNameEntryCache.cs : It should expand temporary buffer even at
	  initial state. Fixed bug #79468.

	* XmlDocumentTests.cs : added bug #79468 case.


svn path=/trunk/mcs/; revision=65803
Atsushi Eno 19 years ago
parent
commit
e2b9ba5fa5

+ 5 - 0
mcs/class/System.XML/System.Xml/ChangeLog

@@ -1,3 +1,8 @@
+2006-09-21  Atsushi Enomoto <[email protected]>
+
+	* XmlNameEntryCache.cs : It should expand temporary buffer even at
+	  initial state. Fixed bug #79468.
+
 2006-09-19  Atsushi Enomoto <[email protected]>
 
 	* XmlElement.cs : for non-atomized names, alter null prefix with "".

+ 3 - 2
mcs/class/System.XML/System.Xml/XmlNameEntryCache.cs

@@ -52,11 +52,12 @@ namespace System.Xml
 
 			if (cacheBuffer == null)
 				cacheBuffer = new char [20];
-			else if (cacheBuffer.Length < prefix.Length + local.Length + 1)
+			if (cacheBuffer.Length < prefix.Length + local.Length + 1)
 				cacheBuffer = new char [Math.Max (
 					prefix.Length + local.Length + 1,
 					cacheBuffer.Length << 1)];
-			prefix.CopyTo (0, cacheBuffer, 0, prefix.Length);				cacheBuffer [prefix.Length] = ':';
+			prefix.CopyTo (0, cacheBuffer, 0, prefix.Length);
+			cacheBuffer [prefix.Length] = ':';
 			local.CopyTo (0, cacheBuffer, prefix.Length + 1, local.Length);
 			return nameTable.Add (cacheBuffer, 0, prefix.Length + local.Length + 1);
 		}

+ 4 - 0
mcs/class/System.XML/Test/System.Xml/ChangeLog

@@ -1,3 +1,7 @@
+2006-09-21  Atsushi Enomoto <[email protected]>
+
+	* XmlDocumentTests.cs : added bug #79468 case.
+
 2006-09-19  Atsushi Enomoto <[email protected]>
 
 	* XmlElementTests.cs : added test for #79420.

+ 12 - 0
mcs/class/System.XML/Test/System.Xml/XmlDocumentTests.cs

@@ -1171,5 +1171,17 @@ namespace MonoTests.System.Xml
 			doc.Load (new StringReader (xml));
 			AssertEquals ("urn:foo", doc.DocumentElement.NamespaceURI);
 		}
+
+		[Test]
+		public void Bug79468 () // XmlNameEntryCache bug
+		{
+			string xml = "<?xml version='1.0' encoding='UTF-8'?>"
+				+ "<ns0:DebtAmountRequest xmlns:ns0='http://whatever'>"
+				+ "  <Signature xmlns='http://www.w3.org/2000/09/xmldsig#' />"
+				+ "</ns0:DebtAmountRequest>";
+			XmlDocument doc = new XmlDocument ();
+			doc.LoadXml (xml);
+			XmlNodeList nodeList = doc.GetElementsByTagName ("Signature");
+		}
 	}
 }