Kaynağa Gözat

stb_vorbis: avoid NaN due to uninitialized variable

Sean Barrett 7 yıl önce
ebeveyn
işleme
b79c8458d3
1 değiştirilmiş dosya ile 2 ekleme ve 0 silme
  1. 2 0
      stb_vorbis.c

+ 2 - 0
stb_vorbis.c

@@ -30,6 +30,7 @@
 //    Tom Beaumont       Ingo Leitgeb        Nicolas Guillemot
 //    Phillip Bennefall  Rohit               Thiago Goulart
 //    manxorist@github   saga musix          github:infatum
+//    Timur Gagiev
 //
 // Partial history:
 //    1.14    - 2018/xx/xx - delete bogus dealloca usage
@@ -4054,6 +4055,7 @@ static int start_decoder(vorb *f)
       f->previous_window[i] = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2);
       f->finalY[i]          = (int16 *) setup_malloc(f, sizeof(int16) * longest_floorlist);
       if (f->channel_buffers[i] == NULL || f->previous_window[i] == NULL || f->finalY[i] == NULL) return error(f, VORBIS_outofmem);
+      memset(f->channel_buffers[i], 0, sizeof(float) * f->blocksize_1);
       #ifdef STB_VORBIS_NO_DEFER_FLOOR
       f->floor_buffers[i]   = (float *) setup_malloc(f, sizeof(float) * f->blocksize_1/2);
       if (f->floor_buffers[i] == NULL) return error(f, VORBIS_outofmem);