Thursday, April 19th, 2007

Fun Safari Bugs Episode 34

Category: Browsers, Tip, WebKit

Tobie Langel fearlessly deals with browser quirks so Prototype users will not have too.

His latest battle revolves around a Regex bug that causes Safari to crash when the string is large.


They fixed the usage of this in some areas but still have issues with JSON sanitization.

The good news is that WebKit nightly seems happy. Come on Leopard! It makes you wish that the browser vendors could try {} catch {} around these issues so you don’t get crashes.

Posted by Dion Almaer at 7:19 am

3.4 rating from 14 votes


Comments feed TrackBack URI

That’s a really depressing bug which I’d never heard of before.

Comment by Dean Edwards — April 19, 2007

I’ve posted a possible fix in the comments on Tobie’s site. I’ll link it here too in case anyone else is having the same problem.

Here’s my response to Tobie’s post:

Comment by Andy Armstrong — April 19, 2007

As Andy noticed, using non-capturing parentheses does not solve the bug, e.g.:


will crash Safari too.

Comment by Tobie Langel — April 19, 2007

Yeah, the key is to modify the fragment that matches the interior of strings so it consumes as many characters as possible – that fixes the problem in the sense that the RE engine has to do /much/ less backtracking.

Comment by Andy Armstrong — April 19, 2007

Note: the capturing parens thing is a complete red herring. My /first/ assumption was that that’d fix it – but as you know it doesn’t.

So the /only fix/ you need is the modification to make the string interior pattern consume as many characters as possible.

Comment by Andy Armstrong — April 19, 2007

Leave a comment

You must be logged in to post a comment.