Trap StackOverflow in html parsing