Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bugs
  • Category Music playback
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Version 3.1
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Frank Grisafi - 2009-03-29
Last edited by Magnus Holmgren - 2009-03-29

FS#10067 - FLAC, Divide by zero error

Using Rockbox 3.2, when playing FLAC files shorter than a second causes the following error:
Divide by zero at 01E56B90

Dreamlayers (Boris Gjenero) already located the source of the error so he deserves credit. Forum post of complete findings:
http://forums.rockbox.org/index.php?topic=21061.msg147362#msg147362

Here’s the bug, in flac_init():

          /* Calculate track length (in ms) and estimate the bitrate
             (in kbit/s) */
          fc->length = (fc->totalsamples / fc->samplerate) * 1000;

That’s integer division, so if the track is shorter than a second, the result is zero. For example, here’s GDB after playing Worms - Jock - Ya Can What Side Yer On.flac, Worms - Jock - Ya Numpty.flac on the r20528 5G iPod sim:

Program received signal SIGFPE, Arithmetic exception.
[Switching to thread 4880.0×818]
0x030a16d5 in flac_init (fc=0x6adfcb0, first_frame_offset=0)

  at /home/Boris/rockbox-dev/apps/codecs/flac.c:175

175 fc→bitrate = ((fc→filesize-fc→metadatalength) * 8 ) / fc→length;
(gdb) p fc→totalsamples
$1 = 16383
(gdb) p fc→samplerate
$2 = 22050
(gdb)

Attached are 3, royalty free, FLAC files that are shorter than a second so whoever takes up this task can test it out.
If any other information is needed please don’t hesitate to ask.

Closed by  Magnus Holmgren
2009-03-29 15:09
Reason for closing:  Fixed
Additional comments about closing:  

Fixed in r20567.

2014-08-18 : A request to re-open the task has been made. Reason for request: I still get this error on FLAC files on 3.13 stable release, or on the latest dev build (18/08/2014) a9713d8-140818. It tells me something like "Divide by zero at 308pc:9080A648 sp:30804Dbt end". The only difference between the stable release and the dev build, is that in the first case, it shutdowns my Sansa Clip+ (which won’t boot again until a hard reset), which is not the case in the second case.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing