From 65f7f559e4d102fc718c832062849378890ce4b7 Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Tue, 15 Mar 2022 22:14:12 +0000 Subject: [PATCH] Fix: Check for packet.bytes >= 1 --- src/format_flac.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/format_flac.c b/src/format_flac.c index a4401dd3..c09a5c10 100644 --- a/src/format_flac.c +++ b/src/format_flac.c @@ -54,18 +54,20 @@ static refbuf_t *process_flac_page (ogg_state_t *ogg_info, ogg_codec_t *codec, o } while (ogg_stream_packetout(&codec->os, &packet)) { - int type = packet.packet[0]; + if (packet.bytes >= 1) { + int type = packet.packet[0]; - if (type == 0xFF) { - codec->headers = 0; - break; + if (type == 0xFF) { + codec->headers = 0; + break; + } + + if (type >= 1 && type <= 0x7E) + continue; + if (type >= 0x81 && type <= 0xFE) + continue; } - if (type >= 1 && type <= 0x7E) - continue; - if (type >= 0x81 && type <= 0xFE) - continue; - ogg_info->error = 1; return NULL;