music_mpg.c (getsome): return error if cvt-> buf is NULL SDL-1.2
authorOzkan Sezer
Sat, 14 Dec 2019 18:12:10 +0300
branchSDL-1.2
changeset 1080dcccb70e568f
parent 1079 7a242c02ac24
child 1081 119300487b73
music_mpg.c (getsome): return error if cvt-> buf is NULL

it means that we did not receive MPG123_NEW_FORMAT from libmpg123.
fixes segfaults with broken files.
music_mpg.c
     1.1 --- a/music_mpg.c	Sat Dec 14 18:10:10 2019 +0300
     1.2 +++ b/music_mpg.c	Sat Dec 14 18:12:10 2019 +0300
     1.3 @@ -314,6 +314,12 @@
     1.4          return 0;
     1.5      }
     1.6  
     1.7 +    if (!cvt->buf) {
     1.8 +        /* not received MPG123_NEW_FORMAT... */
     1.9 +        Mix_SetError("music_mpg: No format.");
    1.10 +        return 0;
    1.11 +    }
    1.12 +
    1.13      SDL_memcpy(cvt->buf, data, cbdata);
    1.14  
    1.15      if (cvt->needed) {