Mozilla bug: The history database is endian.


This page demonstrates the endian-problems in Mozilla's history database.

What's Wrong

The bug is that Mozilla records and displays website titles in an endian-dependent fashion. If a user only ever uses one platform, they'll never notice. If the user changes between big-endian and little-endian machines, their history file will be filled half with big-endian titles and half with little-endian titles, and will not display properly on either platform.

The bug is particularly noticeable when typing URLs into the location bar, because the autocompletion window that pops up will be full of random chinese characters where web site titles should be. For example, compare these two screenshots, one taken on a big-endian machine, the other on a little-endian machine:
screenshot of autocompletion pop-up menu
screenshot of pop-up autocompletion menu


I ran Mozilla in Linux on a PC, and visited a number of sites. Mozilla stored these sites in my history.
I then quit, and moved over to a Sun machine running Solaris. On this machine I visited BBC's World News site. Mozilla remembered that site in my history.

When I view my history on the big-endian Sun, I see gibberish titles for the sites that the Intel machine visited, and correct titles for the sites that the Sun machine visited:
screenshot, big-endian platform

If I go back to the little-endian PC, the little-endian titles are readable, but the titles stored on the big-endian machine aren't readable.
screenshot, little-endian platform

( is my home page, which is the reason that it is readable in each of these screenshots.)

What should have happened

Mozilla should either store titles in an endian-independent fashion, or should use the unicode Byte Order Mark (U+FEFF) to label (and detect) the endian-ness of each title string.

Any other information?

The history.dat file is nearly impenetrable to me. If you're interested, though, here are the first 30 lines of my history.dat file. I can provide the whole file if it would be helpful.

// <!-- <mdb:mork:z v="1.4"/> -->
< <(a=c)> // (f=iso-8859-1)
    =M$00a$00s$00s$00a$00c$00h$00u$00s$00e$00t$00t$00s$00 $00I$00n$00s$00t$00i\
$00t$00u$00t$00e$00 $00o$00f$00 $00T$00e$00c$00h$00n$00o$00l$00o$00g$00y$00)
    =B$00o$00o$00k$00m$00a$00r$00k$00s$00 $00f$00o$00r$00 $00J$00a$00c$00o$00b\
$00 $00M$00o$00r$00z$00i$00n$00s$00k$00i$00)(5BC57=170)(30E
    =B$00B$00C$00 $00N$00e$00w$00s$00 $00|$00 $00W$00O$00R$00L$00D$00)
  (30B8F=T$00o$00p$00 $00S$00t$00o$00r$00i$00e$00s$00)(30672=144)(5F6
    =W$00e$00l$00c$00o$00m$00e$00 $00t$00o$00 $00u$00C$00o$00m$00i$00c$00s$00 \
$00W$00e$00b$00 $00S$00i$00t$00e$00 $00f$00e$00a$00t$00u$00r$00i$00n$00g$00 $00\
S$00t$00o$00n$00e$00 $00S$00o$00u$00p$00 $00-$00-$00 $00T$00h$00e$00 $00B$00e$00\
s$00t$00 $00C$00o$00m$00i$00c$00 $00S$00i$00t$00e$00 $00I$00n$00 $00T$00h$00e$00\


July 2003: this bug is fixed. Check bugzilla for details.