warble: zero the mp3entry before reading metadata

print_mp3entry() dereferences mb_track_id, but get_metadata() does not set
every field of the uninitialized stack struct. For FLAC files this left
garbage in the pointer and warble segfaulted in strlen about a third of the
time, before decoding started. Clear the struct first.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Michael Giacomelli 2026-09-19 16:06:49 -04:00 • committed by Michael
parent e9a6b58870
commit 8f38274e90

View file

@ -839,6 +839,9 @@ static void decode_file(const char *input_fn)
/* Set up ci */
struct mp3entry id3;
/* get_metadata() doesn't set every field; don't leave stack garbage in the
pointers that print_mp3entry() dereferences */
memset(&id3, 0, sizeof(id3));
if (!get_metadata(&id3, input_fd, input_fn)) {
fprintf(stderr, "error: metadata parsing failed\n");
exit(1);