summaryrefslogtreecommitdiffstats
path: root/lz4.c
diff options
context:
space:
mode:
authoryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2012-01-16 22:26:03 (GMT)
committeryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2012-01-16 22:26:03 (GMT)
commit572cab747fc214656bbf9bded1a0d93787d0c2f6 (patch)
tree68578e875873dbcbbe05f95ef21fd91371bfce32 /lz4.c
parent93577f8ce64092f75f55129d3d82b7a9f8a1eb3a (diff)
downloadlz4-572cab747fc214656bbf9bded1a0d93787d0c2f6.zip
lz4-572cab747fc214656bbf9bded1a0d93787d0c2f6.tar.gz
lz4-572cab747fc214656bbf9bded1a0d93787d0c2f6.tar.bz2
Corrected a bug in the decoder in 64-bit mode
git-svn-id: https://lz4.googlecode.com/svn/trunk@51 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
Diffstat (limited to 'lz4.c')
-rw-r--r--lz4.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lz4.c b/lz4.c
index 0979e29..8591110 100644
--- a/lz4.c
+++ b/lz4.c
@@ -153,6 +153,7 @@ typedef struct _U16_S
#define AARCH A64
#define LZ4_COPYSTEP(s,d) A64(d) = A64(s); d+=8; s+=8;
#define LZ4_COPYPACKET(s,d) LZ4_COPYSTEP(s,d)
+#define LZ4_SECURECOPY(s,d,e) if (d<e) LZ4_WILDCOPY(s,d,e)
#define HTYPE U32
#define INITBASE(base) const BYTE* const base = ip
#else // 32-bit
@@ -161,6 +162,7 @@ typedef struct _U16_S
#define AARCH A32
#define LZ4_COPYSTEP(s,d) A32(d) = A32(s); d+=4; s+=4;
#define LZ4_COPYPACKET(s,d) LZ4_COPYSTEP(s,d); LZ4_COPYSTEP(s,d);
+#define LZ4_SECURECOPY LZ4_WILDCOPY
#define HTYPE const BYTE*
#define INITBASE(base) const int base = 0
#endif
@@ -631,13 +633,13 @@ int LZ4_uncompress(char* source,
if (cpy>oend-COPYLENGTH)
{
if (cpy > oend) goto _output_error;
- LZ4_WILDCOPY(ref, op, (oend-COPYLENGTH));
+ LZ4_SECURECOPY(ref, op, (oend-COPYLENGTH));
while(op<cpy) *op++=*ref++;
op=cpy;
if (op == oend) break; // Check EOF (should never happen, since last 5 bytes are supposed to be literals)
continue;
}
- LZ4_WILDCOPY(ref, op, cpy);
+ LZ4_SECURECOPY(ref, op, cpy);
op=cpy; // correction
}
@@ -718,13 +720,13 @@ int LZ4_uncompress_unknownOutputSize(
if (cpy>oend-COPYLENGTH)
{
if (cpy > oend) goto _output_error;
- LZ4_WILDCOPY(ref, op, (oend-COPYLENGTH));
+ LZ4_SECURECOPY(ref, op, (oend-COPYLENGTH));
while(op<cpy) *op++=*ref++;
op=cpy;
if (op == oend) break; // Check EOF (should never happen, since last 5 bytes are supposed to be literals)
continue;
}
- LZ4_WILDCOPY(ref, op, cpy);
+ LZ4_SECURECOPY(ref, op, cpy);
op=cpy; // correction
}