Add detection for Ogg skeleton metadata

This commit is contained in:
Kevin Croft 2018-11-17 21:42:30 -08:00 committed by Sean Barrett
parent 38f86fc461
commit 604b9367ee

View File

@ -374,7 +374,8 @@ enum STBVorbisError
VORBIS_invalid_first_page,
VORBIS_bad_packet_type,
VORBIS_cant_find_last_page,
VORBIS_seek_failed
VORBIS_seek_failed,
VORBIS_ogg_skeleton_not_supported
};
@ -3579,6 +3580,18 @@ static int start_decoder(vorb *f)
// 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);
// check for the Ogg skeleton fishead identifying header to refine our error
if (f->segments[0] == 64 &&
getn(f, header, 6) &&
header[0] == 'f' &&
header[1] == 'i' &&
header[2] == 's' &&
header[3] == 'h' &&
header[4] == 'e' &&
header[5] == 'a' &&
get8(f) == 'd') 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);