From ca53f8b3901eb3e1105864d37192b933c8032f03 Mon Sep 17 00:00:00 2001 From: Eric Lammerts Date: Mon, 23 Sep 2024 16:46:20 -0400 Subject: [PATCH] Fix infinite loop when there's a partial frame at the end of the file. --- shared-module/audiomp3/MP3Decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-module/audiomp3/MP3Decoder.c b/shared-module/audiomp3/MP3Decoder.c index f59f4a4510b6..b135af758693 100644 --- a/shared-module/audiomp3/MP3Decoder.c +++ b/shared-module/audiomp3/MP3Decoder.c @@ -482,7 +482,7 @@ audioio_get_buffer_result_t audiomp3_mp3file_get_buffer(audiomp3_mp3file_obj_t * if (DO_DEBUG) { mp_printf(&mp_plat_print, "%s:%d err=%d\n", __FILE__, __LINE__, err); } - if (err != ERR_MP3_INDATA_UNDERFLOW && err != ERR_MP3_MAINDATA_UNDERFLOW) { + if (self->eof || (err != ERR_MP3_INDATA_UNDERFLOW && err != ERR_MP3_MAINDATA_UNDERFLOW)) { memset(buffer, 0, self->frame_buffer_size); *buffer_length = 0; self->eof = true;