lz4: refine commit 9143a6c55ef7 for the 64-bit case
authorJan Beulich <jbeulich@suse.com>
Mon, 9 Dec 2019 13:01:25 +0000 (14:01 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 9 Dec 2019 13:01:25 +0000 (14:01 +0100)
commit2d7572cdfa4d481c1ca246aa1ce5239ccae7eb59
tree17ede13bac0bcfa9207d6a67e03ed1d2050708e8
parentb813ce366a4313a28b2ac26e92da0cb8d6a01a75
lz4: refine commit 9143a6c55ef7 for the 64-bit case

I clearly went too far there: While the LZ4_WILDCOPY() instances indeed
need prior guarding, LZ4_SECURECOPY() needs this only in the 32-bit case
(where it simply aliases LZ4_WILDCOPY()). "cpy" can validly point
(slightly) below "op" in these cases, due to

cpy = op + length - (STEPSIZE - 4);

where length can be as low as 0 and STEPSIZE is 8. However, instead of
removing the check via "#if !LZ4_ARCH64", refine it such that it would
also properly work in the 64-bit case, aborting decompression instead
of continuing on bogus input.

Reported-by: Mark Pryor <pryorm09@gmail.com>
Reported-by: Jeremi Piotrowski <jeremi.piotrowski@gmail.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Tested-by: Mark Pryor <pryorm09@gmail.com>
Tested-by: Jeremi Piotrowski <jeremi.piotrowski@gmail.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/lz4/decompress.c