Skip to content

Commit

Permalink
Add bounds check to resolve buffer over-read
Browse files Browse the repository at this point in the history
Fixes #1038

ofst over-reads past the end of the pSoundData buffer. Add a bounds check
similar to S_CheckAmplitude() in codemp/client/snd_dma.cpp.

69800e8
  • Loading branch information
namtsui authored and xycaleth committed Jun 9, 2020
1 parent 5203023 commit 4974446
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions codemp/client/snd_mix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ static void S_PaintChannelFrom16( channel_t *ch, const sfx_t *sfx, int count, in

for ( int i=0 ; i<count ; i++ )
{
// have we run off the end?
if ((int)ofst >= sfx->iSoundLengthInSamples)
break;
iData = sfx->pSoundData[ (int)ofst ];

pSamplesDest[i].left += (iData * iLeftVol )>>8;
Expand Down

0 comments on commit 4974446

Please sign in to comment.