http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2195

*** shadow/2195 Fri Jun 15 10:12:41 2001
--- shadow/2195.tmp.22981       Fri Jun 15 10:12:42 2001
***************
*** 0 ****
--- 1,39 ----
+ +============================================================================+
+ | Xerces2: XMLAttributesImpl::removeElementAt corrupts list                  |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 2195                        Product: Xerces2-J               |
+ |       Status: NEW                         Version: 2.0.0 [alpha]           |
+ |   Resolution:                            Platform: All                     |
+ |     Severity: Blocker                  OS/Version: All                     |
+ |     Priority: Other                     Component: Other                   |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: [EMAIL PROTECTED]                                  |
+ |  Reported By: [EMAIL PROTECTED]                                            |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ Now that Namespace declarations are being (correctly) removed from the attribute 
+ list using removeElementAt(), there is a defect when the attribute is not the 
+ last one in the list (am I the only person with such files?)  The current code 
+ at line 200 should be changed from:
+ 
+         if (attrIndex < fLength - 1) {
+             System.arraycopy(fAttributes, attrIndex + 1, fAttributes, attrIndex, 
+ fLength - attrIndex - 1);
+         }
+         fLength--;
+ 
+ to:
+ 
+         fLength--;
+         if (attrIndex < fLength) {
+             Attribute old = fAttributes[attrIndex];
+             System.arraycopy(fAttributes, attrIndex + 1, fAttributes, attrIndex, 
+ fLength - attrIndex);
+             fAttributes[fLength] = old;
+         }
+ 
+ The old code leaked an object and introduced a duplicate pointer into the array 
+ that would later corrupt the list.
\ No newline at end of file

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to