Skip to content

Commit ee47122

Browse files
Dan McDonaldbehlendorf
authored andcommitted
Illumos #4936 fix potential overflow in lz4
4936 lz4 could theoretically overflow a pointer with a certain input Reviewed by: Saso Kiselkov <skiselkov.ml@gmail.com> Reviewed by: Keith Wesolowski <keith.wesolowski@joyent.com> Approved by: Gordon Ross <gordon.ross@nexenta.com> Ported by: Tim Chase <tim@chase2k.com> References: https://illumos.org/issues/4936 illumos/illumos-gate@58d0718 Porting notes: This fixes the widely-reported "20-year-old vulnerability" in LZO/LZ4 implementations which inherited said bug from the reference implementation. Signed-off-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Tim Chase <tim@chase2k.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2429
1 parent 4240dc3 commit ee47122

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

module/zfs/lz4.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,9 @@ LZ4_uncompress_unknownOutputSize(const char *source, char *dest, int isize,
907907
}
908908
/* copy literals */
909909
cpy = op + length;
910+
/* CORNER-CASE: cpy might overflow. */
911+
if (cpy < op)
912+
goto _output_error; /* cpy was overflowed, bail! */
910913
if ((cpy > oend - COPYLENGTH) ||
911914
(ip + length > iend - COPYLENGTH)) {
912915
if (cpy > oend)

0 commit comments

Comments
 (0)