Fixed multiple sanitizer errors in codecs

This commit is contained in:
akallabeth 2020-05-18 17:40:28 +02:00
parent 45860a5561
commit 489cb26ac3
3 changed files with 12 additions and 11 deletions

View File

@ -783,7 +783,7 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear, wStream* s, UINT32
if (vBarUpdate)
{
UINT32 x;
BYTE* pSrcPixel;
BYTE* pSrcPixel = NULL;
BYTE* dstBuffer;
if (clear->VBarStorageCursor >= CLEARCODEC_VBAR_SIZE)
@ -826,8 +826,9 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear, wStream* s, UINT32
if ((y + count) > vBarPixelCount)
count = (vBarPixelCount > y) ? (vBarPixelCount - y) : 0;
pSrcPixel =
&vBarShortEntry->pixels[(y - vBarYOn) * GetBytesPerPixel(clear->format)];
if (count > 0)
pSrcPixel =
&vBarShortEntry->pixels[(y - vBarYOn) * GetBytesPerPixel(clear->format)];
for (x = 0; x < count; x++)
{

View File

@ -113,14 +113,12 @@ static BOOL nsc_decode(NSC_CONTEXT* context)
static BOOL nsc_rle_decode(BYTE* in, BYTE* out, UINT32 outSize, UINT32 originalSize)
{
UINT32 len;
UINT32 left;
BYTE value;
left = originalSize;
UINT32 left = originalSize;
while (left > 4)
{
value = *in++;
const BYTE value = *in++;
UINT32 len = 0;
if (left == 5)
{
@ -143,8 +141,10 @@ static BOOL nsc_rle_decode(BYTE* in, BYTE* out, UINT32 outSize, UINT32 originalS
else
{
in++;
len = *((UINT32*)in);
in += 4;
len = ((UINT32)(*in++));
len |= ((UINT32)(*in++)) << 8U;
len |= ((UINT32)(*in++)) << 16U;
len |= ((UINT32)(*in++)) << 24U;
}
if (outSize < len)

View File

@ -1183,7 +1183,7 @@ static INLINE int progressive_rfx_upgrade_block(RFX_PROGRESSIVE_UPGRADE_STATE* s
sign[index] = input;
}
buffer[index] += (input << shift);
buffer[index] += (INT16)((UINT32)input << shift);
}
return 1;