lz4: fix system halt at boot kernel on x86_64
Sometimes, on x86_64, decompression fails with the following
error:
Decompressing Linux...
Decoding failed
-- System halted
This condition is not needed for a 64bit kernel(from commit d5e7caf
):
if( ... ||
(op + COPYLENGTH) > oend)
goto _output_error
macro LZ4_SECURE_COPY() tests op and does not copy any data
when op exceeds the value.
added by analogy to lz4_uncompress_unknownoutputsize(...)
Signed-off-by: Krzysztof Kolasa <kkolasa@winsoft.pl>
Tested-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Tested-by: Caleb Jorden <cjorden@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
61a590fa67
commit
99b7e93c95
|
@ -140,8 +140,12 @@ static int lz4_uncompress(const char *source, char *dest, int osize)
|
||||||
/* Error: request to write beyond destination buffer */
|
/* Error: request to write beyond destination buffer */
|
||||||
if (cpy > oend)
|
if (cpy > oend)
|
||||||
goto _output_error;
|
goto _output_error;
|
||||||
|
#if LZ4_ARCH64
|
||||||
|
if ((ref + COPYLENGTH) > oend)
|
||||||
|
#else
|
||||||
if ((ref + COPYLENGTH) > oend ||
|
if ((ref + COPYLENGTH) > oend ||
|
||||||
(op + COPYLENGTH) > oend)
|
(op + COPYLENGTH) > oend)
|
||||||
|
#endif
|
||||||
goto _output_error;
|
goto _output_error;
|
||||||
LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
|
LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
|
||||||
while (op < cpy)
|
while (op < cpy)
|
||||||
|
@ -266,7 +270,13 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
|
||||||
if (cpy > oend - COPYLENGTH) {
|
if (cpy > oend - COPYLENGTH) {
|
||||||
if (cpy > oend)
|
if (cpy > oend)
|
||||||
goto _output_error; /* write outside of buf */
|
goto _output_error; /* write outside of buf */
|
||||||
|
#if LZ4_ARCH64
|
||||||
|
if ((ref + COPYLENGTH) > oend)
|
||||||
|
#else
|
||||||
|
if ((ref + COPYLENGTH) > oend ||
|
||||||
|
(op + COPYLENGTH) > oend)
|
||||||
|
#endif
|
||||||
|
goto _output_error;
|
||||||
LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
|
LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
|
||||||
while (op < cpy)
|
while (op < cpy)
|
||||||
*op++ = *ref++;
|
*op++ = *ref++;
|
||||||
|
|
Loading…
Reference in New Issue