| Summary: | Possible memory overflow in Mix_LoadWAV_RW | ||
|---|---|---|---|
| Product: | SDL_mixer | Reporter: | Lee Salzman <lsalzman> |
| Component: | misc | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.0 | ||
| Hardware: | All | ||
| OS: | All | ||
Fixed, thanks! https://hg.libsdl.org/SDL_mixer/rev/ebb26212a00f |
In mixer.c, Mix_LoadWAV_RW, there is the following code: wavecvt.len = chunk->alen & ~(samplesize-1); wavecvt.buf = (Uint8 *)SDL_calloc(1, wavecvt.len*wavecvt.len_mult); ... SDL_memcpy(wavecvt.buf, chunk->abuf, chunk->alen); That SDL_memcpy should rather be: SDL_memcpy(wavectf.buf, chunk->abuf, wavecvt.len); If you imagine that wavecvt.len_mult was 1 and samplesize was greater than 1 with wavecvt.len < chunk->alen, then it may overwrite.