Crash when this particular mp3 finishes playing (909.8 KB)

Encoded by Audacity as mp3, forced mono, vbr 48 kbps

  • When trimmed to 5 seconds no crash occurs

  • when converted to CBR, no crash occurs

  • Only on hardware, on simulator it finishes fine

        self.player ="music/E3M6_vbr_48.mp3", 2)

Error accessing buffer at 0x60143636

Found it. The problem is the end of the file has some frames that are smaller than the 38 byte minimum I'd assumed, which leads to us trying to read a negative number of bytes off the disk. In the simulator that's ignored (I think?) but on the device it's passed unsigned, which means it tries to read ~4GB of data and overflows the buffer. Oops. :frowning: We should push the extra bytes back to the buffer instead.

The LAME encoder has a minimum bitrate flag that would probably work around this, but I don't see any way to use that in Audacity.. But it looks like trimming the silence at the end of the file will keep this from happening until I get the bug fixed. After cutting it back to 2m54.8s and re-exporting I don't see any short frames. Or you can just trim the original mp3, looks like the first short frame is at offset 0xE6B9C: (909.6 KB)

1 Like

Marking as solution since there are many workarounds. I'd consider this low prio

1 Like

@dave Re-opening this issue because the inverse has now occurred:

The attached 32kbps abr (average bitrate) MP3

  • plays fine on hardware using firmware 1.13.0 beta6
  • crashes simulator 1.12.3 immediately on playback.

As before, choosing CBR as an encoding parameter works on both simulator and hardware. I'd much prefer ABR though, because it has a smaller filesize for comparable quality

I have used the option in the simulator to send a crash report to Panic.
Note: I have erroneously reported there that it was encoded as VBR, while in fact it is ABR (average bitrate) (57.7 KB)

1.12.3 had a bug in the mp3 decoder where a frame smaller than 38 bytes causes a negative read length, which then crashes. I'll DM you a 1.13.0b6 simulator build. What platform are you on?

Thanks. I'm on MacOS Intel