Browse Source

SDL_audiotypecvt.c: Fixed memory corruption when resampling S16 t F32

(cherry picked from commit ca010165770b31ddebf334bc5709302b0d6da41e)
Wohlstand 1 year ago
parent
commit
384fcea585
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/audio/SDL_audiotypecvt.c

+ 1 - 1
src/audio/SDL_audiotypecvt.c

@@ -125,7 +125,7 @@ static void SDLCALL SDL_Convert_U8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFor
 
 static void SDLCALL SDL_Convert_S16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format)
 {
-    const int num_samples = cvt->len_cvt;
+    const int num_samples = cvt->len_cvt / sizeof(Sint16);
     const Sint16 *src = (const Sint16 *)cvt->buf;
     float *dst = (float *)cvt->buf;
     int i;