Skip to content

Commit

Permalink
music_mpg.c (getsome): return error if cvt-> buf is NULL
Browse files Browse the repository at this point in the history
it means that we did not receive MPG123_NEW_FORMAT from libmpg123.
fixes segfaults with broken files.
  • Loading branch information
sezero committed Dec 14, 2019
1 parent b347209 commit e78e3fb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions music_mpg.c
Expand Up @@ -314,6 +314,12 @@ getsome(mpg_data* m)
return 0;
}

if (!cvt->buf) {
/* not received MPG123_NEW_FORMAT... */
Mix_SetError("music_mpg: No format.");
return 0;
}

SDL_memcpy(cvt->buf, data, cbdata);

if (cvt->needed) {
Expand Down

0 comments on commit e78e3fb

Please sign in to comment.