Browse Source

[raudio] Fixed buffer overflow when loading WAV files (#4539)

pull/4556/head
Caleb Heydon 2 weeks ago
committed by GitHub
parent
commit
58fe34d9cc
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/raudio.c

+ 2
- 2
src/raudio.c View File

@ -801,10 +801,10 @@ Wave LoadWaveFromMemory(const char *fileType, const unsigned char *fileData, int
wave.sampleRate = wav.sampleRate; wave.sampleRate = wav.sampleRate;
wave.sampleSize = 16; wave.sampleSize = 16;
wave.channels = wav.channels; wave.channels = wav.channels;
wave.data = (short *)RL_MALLOC(wave.frameCount*wave.channels*sizeof(short));
wave.data = (short *)RL_MALLOC(p">(size_t)wave.frameCount*wave.channels*sizeof(short));
// NOTE: We are forcing conversion to 16bit sample size on reading // NOTE: We are forcing conversion to 16bit sample size on reading
drwav_read_pcm_frames_s16(&wav, wav.totalPCMFrameCount, wave.data);
drwav_read_pcm_frames_s16(&wav, wave.frameCount, wave.data);
} }
else TRACELOG(LOG_WARNING, "WAVE: Failed to load WAV data"); else TRACELOG(LOG_WARNING, "WAVE: Failed to load WAV data");

Loading…
Cancel
Save