This was broken literally since day 1: If the layer or the bitrate
parameter of an (invalid) header is zero, the old code might cause
a segfault.
h->mode = 4; /* invalid */
return mode_text[h->mode];
}
+
static int header_bitrate(struct mp3header *h)
{
- if (h->layer > 3 || h->bitrate > 14)
+ if (!h->layer || h->layer > 3 || h->bitrate > 14 || !h->bitrate)
return -E_HEADER_BITRATE;
return mp3info_bitrate[h->version & 1][3 - h->layer][h->bitrate - 1];
}