Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#47 "fall back to read() if mmap() fails" doesn't really work

Joe Drew

First of all, I should say that I am experimenting with mpg321 0.2.13-2 in uClinux where no MMU exists. So here's what happens when mpg321 tries to load a big enough mp3 (I used a 9 megabyte one):

1. mad.c:670: In calc_length(), mmap() fails to allocate 9 mb. (My embedded system's memory is limited.) The function exits with -1.
2. mpg321.c:625: No one checks that error code. Who knows what playbuf contains at that moment...
3. mpg321.c:641: mmap() fails here too for the same reason. Luckily, continue is here, so the undefined contents of playbuf isn't an issue.
4. the program finishes.

The "goto fall_back_to_read_from_fd" (mpg321.c:619) doesn't work since I'm trying to read from a regular file, not from a pipe. So it's not really a fallback in this case. Besides, there's no such "fallback" in calc_length() at all.


  • In what embedded platform are you testing mpg321?
    Can you please report the same bug in Debian PTS Site?