From d1dc3fe89c35508db224ed4155ecd56a78d2e2ab Mon Sep 17 00:00:00 2001 From: Kevin Croft Date: Sun, 18 Nov 2018 19:07:55 -0800 Subject: [PATCH] Fix return typo, disambiguate else, and check for the complete fishead identifier --- stb_vorbis.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stb_vorbis.c b/stb_vorbis.c index da3156a..263cfc7 100644 --- a/stb_vorbis.c +++ b/stb_vorbis.c @@ -3579,7 +3579,7 @@ static int start_decoder(vorb *f) if (f->page_flag & PAGEFLAG_continued_packet) return error(f, VORBIS_invalid_first_page); // check for expected packet length if (f->segment_count != 1) return error(f, VORBIS_invalid_first_page); - if (f->segments[0] != 30) return error(f, VORBIS_invalid_first_page); + if (f->segments[0] != 30) { // check for the Ogg skeleton fishead identifying header to refine our error if (f->segments[0] == 64 && getn(f, header, 6) && @@ -3589,9 +3589,12 @@ static int start_decoder(vorb *f) header[3] == 'h' && header[4] == 'e' && header[5] == 'a' && - get8(f) == 'd') return error(f, VORBIS_ogg_skeleton_not_supported); + get8(f) == 'd' && + get8(f) == '\0') return error(f, VORBIS_ogg_skeleton_not_supported); else return error(f, VORBIS_invalid_first_page); + } + // read packet // check packet header if (get8(f) != VORBIS_packet_id) return error(f, VORBIS_invalid_first_page);