summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith M Wesolowski <wesolows@foobazco.org>2014-06-26 22:33:35 +0000
committerKeith M Wesolowski <wesolows@foobazco.org>2014-06-26 22:33:35 +0000
commitdfb423e13dce7c91059cc1b29429e326d6737ba3 (patch)
tree89e9dfad4f452759f5df0bb0a424d7550d468075
parentb93eaeec23936341489bb38d92e74dbd01d307c0 (diff)
parent58d0718061c87e3d647c891ec5281b93c08dba4e (diff)
downloadillumos-joyent-dfb423e13dce7c91059cc1b29429e326d6737ba3.tar.gz
[illumos-gate merge]
commit 58d0718061c87e3d647c891ec5281b93c08dba4e 4936 lz4 could theoretically overflow a pointer with a certain input
-rw-r--r--usr/src/grub/grub-0.97/stage2/zfs_lz4.c3
-rw-r--r--usr/src/uts/common/fs/zfs/lz4.c6
2 files changed, 9 insertions, 0 deletions
diff --git a/usr/src/grub/grub-0.97/stage2/zfs_lz4.c b/usr/src/grub/grub-0.97/stage2/zfs_lz4.c
index 42c03f9135..6d94111538 100644
--- a/usr/src/grub/grub-0.97/stage2/zfs_lz4.c
+++ b/usr/src/grub/grub-0.97/stage2/zfs_lz4.c
@@ -214,6 +214,9 @@ LZ4_uncompress_unknownOutputSize(const char *source,
}
/* copy literals */
cpy = op + length;
+ /* CORNER-CASE: cpy might overflow. */
+ if (cpy < op)
+ goto _output_error; /* cpy was overflowed, bail! */
if ((cpy > oend - COPYLENGTH) ||
(ip + length > iend - COPYLENGTH)) {
if (cpy > oend)
diff --git a/usr/src/uts/common/fs/zfs/lz4.c b/usr/src/uts/common/fs/zfs/lz4.c
index 40cb0711e0..656360a6f2 100644
--- a/usr/src/uts/common/fs/zfs/lz4.c
+++ b/usr/src/uts/common/fs/zfs/lz4.c
@@ -960,6 +960,9 @@ real_LZ4_uncompress(const char *source, char *dest, int osize)
}
/* copy literals */
cpy = op + length;
+ /* CORNER-CASE: cpy might overflow. */
+ if (cpy < op)
+ goto _output_error; /* cpy was overflowed, bail! */
if unlikely(cpy > oend - COPYLENGTH) {
if (cpy != oend)
/* Error: we must necessarily stand at EOF */
@@ -1075,6 +1078,9 @@ LZ4_uncompress_unknownOutputSize(const char *source, char *dest, int isize,
}
/* copy literals */
cpy = op + length;
+ /* CORNER-CASE: cpy might overflow. */
+ if (cpy < op)
+ goto _output_error; /* cpy was overflowed, bail! */
if ((cpy > oend - COPYLENGTH) ||
(ip + length > iend - COPYLENGTH)) {
if (cpy > oend)