You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because the parser will move down and up, the DomReader.reassignCurrentElement in linear time $O(n)$. For each element, this function will be called in $O(n)$. Finally, complete in $O(n^2)$.
Then, I'm not sure the implementation of Element.item(int). In my understanding, some of implementations used linked list and make it worse in $O(n^2)$ in one DomReader.reassignCurrentElement.
Actually the code was written 19 years ago (predates my time with XStream), but I confess the current implementation is unfortunate for elements with a lot of children.
This can be considered as a security issue. An attacker can send XML with many elements to perform DOS attack on a server.
No, but you're free to prove it. DOM is a memory-based model. You'll never get an XML structure loaded with so many elements to slow down this code significantly enough for a DOS attack. You'll run into an OOME first.
Target Object
Source Code
The parser will achieve$O(n^2)$ time when switching context.
https://github.com/x-stream/xstream/blob/master/xstream/src/java/com/thoughtworks/xstream/io/xml/DomReader.java#L135
Because the parser will move down and up, the$O(n)$ . For each element, this function will be called in $O(n)$ . Finally, complete in $O(n^2)$ .
DomReader.reassignCurrentElement
in linear timeThen, I'm not sure the implementation of$O(n^2)$ in one
Element.item(int)
. In my understanding, some of implementations used linked list and make it worse inDomReader.reassignCurrentElement
.Here is my workaround for your reference.
The text was updated successfully, but these errors were encountered: