• Status Closed
  • Percent Complete
  • 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 JobVanDam - 2009-03-29
Last edited by learman - 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:

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

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  learman
2009-03-29 15:09
Reason for closing:  Fixed
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

Fixed in r20567.

2014-08-18: A request to reopen 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.


Available keyboard shortcuts


Task Details

Task Editing