mirror of https://github.com/FreeRDP/FreeRDP
Fixed undefined behaviour in rfx decoder
This commit is contained in:
parent
ee160fc414
commit
a1dd25e219
|
@ -282,7 +282,10 @@ int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* pSrcData, UINT32 SrcSize, INT16*
|
|||
break;
|
||||
|
||||
bs->mask = ((1 << kr) - 1);
|
||||
code = (UINT16)((bs->accumulator >> (32 - kr)) & bs->mask);
|
||||
if (kr > 0)
|
||||
code = (UINT16)((bs->accumulator >> (32 - kr)) & bs->mask);
|
||||
else
|
||||
code = 0;
|
||||
BitStream_Shift(bs, kr);
|
||||
|
||||
/* add (vk << kr) to code */
|
||||
|
@ -390,7 +393,10 @@ int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* pSrcData, UINT32 SrcSize, INT16*
|
|||
break;
|
||||
|
||||
bs->mask = ((1 << kr) - 1);
|
||||
code = (UINT16)((bs->accumulator >> (32 - kr)) & bs->mask);
|
||||
if (kr > 0)
|
||||
code = (UINT16)((bs->accumulator >> (32 - kr)) & bs->mask);
|
||||
else
|
||||
code = 0;
|
||||
BitStream_Shift(bs, kr);
|
||||
|
||||
/* add (vk << kr) to code */
|
||||
|
@ -477,7 +483,10 @@ int rfx_rlgr_decode(RLGR_MODE mode, const BYTE* pSrcData, UINT32 SrcSize, INT16*
|
|||
break;
|
||||
|
||||
bs->mask = ((1 << nIdx) - 1);
|
||||
val1 = ((bs->accumulator >> (32 - nIdx)) & bs->mask);
|
||||
if (nIdx > 0)
|
||||
val1 = ((bs->accumulator >> (32 - nIdx)) & bs->mask);
|
||||
else
|
||||
val1 = 0;
|
||||
BitStream_Shift(bs, nIdx);
|
||||
|
||||
val2 = code - val1;
|
||||
|
|
Loading…
Reference in New Issue