src/audio/SDL_wave.c
branchSDL-1.2
changeset 12817 faf9abbcfb5f
parent 12816 416136310b88
child 12818 a8afedbcaea0
     1.1 --- a/src/audio/SDL_wave.c	Mon Jun 10 08:54:11 2019 -0700
     1.2 +++ b/src/audio/SDL_wave.c	Mon Jun 10 08:54:29 2019 -0700
     1.3 @@ -147,6 +147,9 @@
     1.4  		if ( stereo ) {
     1.5  			state[1]->hPredictor = *encoded++;
     1.6  		}
     1.7 +		if (state[0]->hPredictor >= 7 || state[1]->hPredictor >= 7) {
     1.8 +			goto invalid_predictor;
     1.9 +		}
    1.10  		state[0]->iDelta = ((encoded[1]<<8)|encoded[0]);
    1.11  		encoded += sizeof(Sint16);
    1.12  		if ( stereo ) {
    1.13 @@ -217,6 +220,10 @@
    1.14  	SDL_SetError("Too short chunk for a MS ADPCM decoder");
    1.15  	SDL_free(freeable);
    1.16  	return(-1);
    1.17 +invalid_predictor:
    1.18 +	SDL_SetError("Invalid predictor value for a MS ADPCM decoder");
    1.19 +	SDL_free(freeable);
    1.20 +	return(-1);
    1.21  }
    1.22  
    1.23  struct IMA_ADPCM_decodestate {