mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-03-23 22:38:13 +05:00
Revert accidentally pushed "LCEMP RCE fixes"
This reverts commit d557ca2dfb.
This commit is contained in:
@@ -237,19 +237,9 @@ HRESULT Compression::DecompressLZXRLE(void *pDestination, unsigned int *pDestSiz
|
||||
unsigned char *dynamicRleBuf = nullptr;
|
||||
HRESULT decompressResult;
|
||||
|
||||
unsigned int safeRleSize = max(rleSize, *pDestSize);
|
||||
|
||||
const unsigned int MAX_RLE_ALLOC = 16 * 1024 * 1024; // 16 MB
|
||||
if (safeRleSize > MAX_RLE_ALLOC)
|
||||
{
|
||||
LeaveCriticalSection(&rleDecompressLock);
|
||||
*pDestSize = 0;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (safeRleSize > staticRleSize)
|
||||
if(*pDestSize > rleSize)
|
||||
{
|
||||
rleSize = safeRleSize;
|
||||
rleSize = *pDestSize;
|
||||
dynamicRleBuf = new unsigned char[rleSize];
|
||||
decompressResult = Decompress(dynamicRleBuf, &rleSize, pSource, SrcSize);
|
||||
pucIn = (unsigned char *)dynamicRleBuf;
|
||||
@@ -273,7 +263,7 @@ HRESULT Compression::DecompressLZXRLE(void *pDestination, unsigned int *pDestSiz
|
||||
//unsigned char *pucIn = (unsigned char *)rleDecompressBuf;
|
||||
const unsigned char *pucEnd = pucIn + rleSize;
|
||||
unsigned char *pucOut = static_cast<unsigned char*>(pDestination);
|
||||
unsigned char *pucOutEnd = pucOut + *pDestSize;
|
||||
const unsigned char *pucOutEnd = pucOut + *pDestSize;
|
||||
|
||||
while( pucIn != pucEnd )
|
||||
{
|
||||
@@ -285,11 +275,7 @@ HRESULT Compression::DecompressLZXRLE(void *pDestination, unsigned int *pDestSiz
|
||||
if( count < 3 )
|
||||
{
|
||||
count++;
|
||||
if (pucOut + count > pucOutEnd)
|
||||
{
|
||||
pucOut = pucOutEnd;
|
||||
break;
|
||||
}
|
||||
if( pucOut + count > pucOutEnd ) break;
|
||||
for( unsigned int i = 0; i < count; i++ )
|
||||
{
|
||||
*pucOut++ = 255;
|
||||
@@ -300,11 +286,7 @@ HRESULT Compression::DecompressLZXRLE(void *pDestination, unsigned int *pDestSiz
|
||||
count++;
|
||||
if( pucIn >= pucEnd ) break;
|
||||
const unsigned char data = *pucIn++;
|
||||
if (pucOut + count > pucOutEnd)
|
||||
{
|
||||
pucOut = pucOutEnd;
|
||||
break;
|
||||
}
|
||||
if( pucOut + count > pucOutEnd ) break;
|
||||
for( unsigned int i = 0; i < count; i++ )
|
||||
{
|
||||
*pucOut++ = data;
|
||||
@@ -335,7 +317,7 @@ HRESULT Compression::DecompressRLE(void *pDestination, unsigned int *pDestSize,
|
||||
unsigned char *pucIn = static_cast<unsigned char *>(pSource);
|
||||
const unsigned char *pucEnd = pucIn + SrcSize;
|
||||
unsigned char *pucOut = static_cast<unsigned char*>(pDestination);
|
||||
unsigned char *pucOutEnd = pucOut + *pDestSize;
|
||||
const unsigned char *pucOutEnd = pucOut + *pDestSize;
|
||||
|
||||
while( pucIn != pucEnd )
|
||||
{
|
||||
@@ -347,11 +329,7 @@ HRESULT Compression::DecompressRLE(void *pDestination, unsigned int *pDestSize,
|
||||
if( count < 3 )
|
||||
{
|
||||
count++;
|
||||
if (pucOut + count > pucOutEnd)
|
||||
{
|
||||
pucOut = pucOutEnd;
|
||||
break;
|
||||
}
|
||||
if( pucOut + count > pucOutEnd ) break;
|
||||
for( unsigned int i = 0; i < count; i++ )
|
||||
{
|
||||
*pucOut++ = 255;
|
||||
@@ -362,11 +340,7 @@ HRESULT Compression::DecompressRLE(void *pDestination, unsigned int *pDestSize,
|
||||
count++;
|
||||
if( pucIn >= pucEnd ) break;
|
||||
const unsigned char data = *pucIn++;
|
||||
if (pucOut + count > pucOutEnd)
|
||||
{
|
||||
pucOut = pucOutEnd;
|
||||
break;
|
||||
}
|
||||
if( pucOut + count > pucOutEnd ) break;
|
||||
for( unsigned int i = 0; i < count; i++ )
|
||||
{
|
||||
*pucOut++ = data;
|
||||
|
||||
Reference in New Issue
Block a user