From kragen at pobox.com Thu May 10 03:37:02 2007 From: kragen at pobox.com (Kragen Javier Sitaker) Date: Thu May 10 03:37:03 2007 Subject: disk corruption and a broken Firefox Message-ID: <20070510024845.GA30585@canonical.org> So Mozilla broke on my laptop one day. I first realized there was a problem when my friend Kelly tried to use it for Gmail, and clicking on a certain link reliably crashed the browser. (Unfortunately, Kelly didn't realize that when the dialog box popped up and said, "Start New Session or Restore Previous Session?", the "Start New Session" button should actually have been labeled "Discard All of the Web Pages Kragen Previously Had Open, Making Him Very Sad".) There had actually been an incident a few days earlier in which some unknown page crashed the browser. After a few "Restore Session"s, the browser had forgotten most of the pages I had previously had open. But I figured that this was not likely to re-occur. But then it did. After Kelly's problem, there was a page on www.cnn.com that crashed the browser every time I tried to view it. I edited the "sessionstore.js" file (in .mozilla/firefox/m9e6kquo.default/) to change all the recent URLs to something that wouldn't work --- mostly by adding "/broken" in the URL path, e.g. http://www.example.com/foo/bar would become http://www.example.com/broken/foo/bar. This let me figure out which page caused the problem. At this point, I figured I was running into a browser bug that probably every Firefox user had in a latent form, maybe one triggered by my own unusual configuration, and that was only appearing now due to something having changed on the web. I asked my friend Meredith Patterson to look at the page on her Mac OS X browser, but she had no trouble. Tracking it down ---------------- I saved the CNN page to my local machine (using Konqueror as a web browser) and found that it still crashed. My next priority was to cut down the crash to a small, reproducible case, so I cut out all the external links --- inline images, stylesheets, and the like --- by rewriting "http://" links as "xhttp://" links, which were guaranteed to not work. It stopped crashing, so I changed some of the "xhttp://" things back to "http://" until I found one that made the browser crash again. I tried running gdb on the Firefox process at this point, but all it told me was that it crashed while trying to execute a nonsense address. No clue about where it jumped to the nonsense address from, or why, although it did make me feel that the bug was probably fairly serious and possibly an exploitable security hole. Eventually, though, I gave up on the gdb approach. It turned out that the only external thing needed to reproduce the crash was a single external JavaScript file, main.js, and the contents of the page. (I tried an HTML file with just a