Unverified Commit 305b122d authored by Brad Smith's avatar Brad Smith Committed by GitHub
Browse files

sound.c type mismatch, possible out of bound read?

This code seems to be copy pasted from audio.c Audio_Callback and modified. "SNDBUF" is not a Uint8* like the original "stream" so the remaining samples logic here was off by a factor of 2.
parent 05c7f4e9
......@@ -1496,7 +1496,7 @@ for (i = 0; i < nGeneratedSamples; i++)
if (nGeneratedSamples >= len/2)
{
int remaining = len - nGeneratedSamples;
memcpy(pBuffer, SNDBUF+(nGeneratedSamples-remaining)*4, remaining*4);
memcpy(pBuffer, ((Uint8*)SNDBUF)+(nGeneratedSamples-remaining)*4, remaining*4);
}
CompleteSndBufIdx += nGeneratedSamples;
nGeneratedSamples = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment