News for hackers. Stuff that matters.
Re:Billion laughs by ilcavero on Saturday October 20, 2012 @02:53PM (#4677876)
so, how do I protect myself against this?
Re:Billion laughs by praptak on Saturday October 20, 2012 @03:08PM (#4677931)
Assign a limited memory pool to the parser, it's in the article.
Re:Billion laughs by davyjones on Saturday October 20, 2012 @03:24PM (#4677992)
Most of the xml libraries already have the fix.
Re:Billion laughs by njharman on Sunday October 21, 2012 @12:03AM (#4678929)
Stop using XML.
Re:Billion laughs by Evbn on Saturday October 20, 2012 @03:26PM (#4677999)
Use a parser or data structure that doesn't duplicate identical objects.

Functional programming wins here.

Re:Billion laughs by Nitramp on Sunday October 21, 2012 @08:55AM (#4679603)
You might, but the expansion happens on a level that might be really hard to implement if you want to keep XML semantics. E.g. in the DOM API, each element has its own identity - you can't collapse identical objects (or you could, but the objects generated this way aren't identical, they have different parent nodes for example).
Re:Billion laughs by sltkr on Sunday October 21, 2012 @10:04AM (#4679723)
That's hardly a fool-proof solution, because you still end up with a document that's has a very large logical size (even if you represent it in a very compact way in memory) and any non-trivial operation on the resulting string that needs to evaluate it on a character-by-character basis (e.g. a substring search) will still take "forever" to complete.