mirror of https://github.com/FreeRDP/FreeRDP
Merge pull request #4694 from akallabeth/mic_crash_fix
Fixed #4693: Fix integer underflow in encoder loop.
This commit is contained in:
commit
dad6b7a534
|
@ -839,6 +839,7 @@ static BOOL freerdp_dsp_encode_ms_adpcm(FREERDP_DSP_CONTEXT* context, const BYTE
|
|||
BYTE* dst;
|
||||
INT32 sample;
|
||||
UINT32 out_size;
|
||||
const size_t step = 8 + (context->format.nChannels > 1) ? 4 : 0;
|
||||
out_size = size / 2;
|
||||
|
||||
if (!Stream_EnsureRemainingCapacity(out, out_size))
|
||||
|
@ -852,7 +853,7 @@ static BOOL freerdp_dsp_encode_ms_adpcm(FREERDP_DSP_CONTEXT* context, const BYTE
|
|||
if (context->adpcm.ms.delta[1] < 16)
|
||||
context->adpcm.ms.delta[1] = 16;
|
||||
|
||||
while (size > 0)
|
||||
while (size >= step)
|
||||
{
|
||||
if ((dst - Stream_Buffer(out)) % context->format.nBlockAlign == 0)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue