Coding, Foss, Technology

Firefox Bug 500784 – Video/audio files over 2GBs in size are unseekable

After having worked on another Theora/Firefox bug, I thought I would continue working in the same stream. While hunting on Bugzilla, I came across 500784.

This bug was filed in 2009, and has received decreasing attention since. Two hacky patches were submitted for it in 2009 by Chris Double and Matthew Gregan, but for whatever reason, were not formalized. None the less, they made my job easier.

To produce the error, I first had to find a video file over 2GB (preferably OGG), and a smaller one for comparison. I ended up finding some random lecture videos online and used those. The following screen-shots show the difference in how the smaller and larger videos render by default in Firefox 11.

As you can see, the first video, that which is smaller than 2GB, renders a duration for the video which shows to the bottom right of the video. The second video though, that which is larger than 2GB does not return a duration, and thus the entire video plays like a stream, not allowing the user to seek any portion of it.

Upon investigation, I found that this was occurring because the video length returned a very large negative number instead of the actual value (overflow anyone?). Hence the video player assumed that the duration of the video was unknown, and that it was indeed a stream.

The problem was occurring, as you might imagine, because the video duration was returned in a 32-bit Integer which overflowed.

These two lines of code is how it was actually retrieved:

      PRInt32 cl = -1;

Fixing this required getting the content length from another source, which along with the entire patch diff can be seen here.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s