better compatibility with Visual <= 2012

This commit is contained in:
Yann Collet
2016-02-19 17:33:43 +01:00
parent 191b52a8dc
commit f8482131d7
+9 -6
View File
@@ -810,6 +810,9 @@ size_t HUF_decompress4X2_usingDTable(
const void* cSrc, size_t cSrcSize, const void* cSrc, size_t cSrcSize,
const U16* DTable) const U16* DTable)
{ {
/* Check */
if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */
{
const BYTE* const istart = (const BYTE*) cSrc; const BYTE* const istart = (const BYTE*) cSrc;
BYTE* const ostart = (BYTE*) dst; BYTE* const ostart = (BYTE*) dst;
BYTE* const oend = ostart + dstSize; BYTE* const oend = ostart + dstSize;
@@ -818,9 +821,6 @@ size_t HUF_decompress4X2_usingDTable(
const U32 dtLog = DTable[0]; const U32 dtLog = DTable[0];
size_t errorCode; size_t errorCode;
/* Check */
if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */
/* Init */ /* Init */
BIT_DStream_t bitD1; BIT_DStream_t bitD1;
BIT_DStream_t bitD2; BIT_DStream_t bitD2;
@@ -895,6 +895,7 @@ size_t HUF_decompress4X2_usingDTable(
/* decoded size */ /* decoded size */
return dstSize; return dstSize;
}
} }
@@ -1559,6 +1560,10 @@ size_t HUF_decompress4X6_usingDTable(
const void* cSrc, size_t cSrcSize, const void* cSrc, size_t cSrcSize,
const U32* DTable) const U32* DTable)
{ {
/* Check */
if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */
{
const BYTE* const istart = (const BYTE*) cSrc; const BYTE* const istart = (const BYTE*) cSrc;
BYTE* const ostart = (BYTE*) dst; BYTE* const ostart = (BYTE*) dst;
BYTE* const oend = ostart + dstSize; BYTE* const oend = ostart + dstSize;
@@ -1570,9 +1575,6 @@ size_t HUF_decompress4X6_usingDTable(
const HUF_DSeqX6* ds = (const HUF_DSeqX6*)dsPtr; const HUF_DSeqX6* ds = (const HUF_DSeqX6*)dsPtr;
size_t errorCode; size_t errorCode;
/* Check */
if (cSrcSize < 10) return ERROR(corruption_detected); /* strict minimum : jump table + 1 byte per stream */
/* Init */ /* Init */
BIT_DStream_t bitD1; BIT_DStream_t bitD1;
BIT_DStream_t bitD2; BIT_DStream_t bitD2;
@@ -1648,6 +1650,7 @@ size_t HUF_decompress4X6_usingDTable(
/* decoded size */ /* decoded size */
return dstSize; return dstSize;
}
} }