summaryrefslogtreecommitdiffstats
path: root/COPYING
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2014-09-27 12:31:37 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-30 09:35:11 -0700
commit96894152592785638ba49e3a55c5bc218aafc49e (patch)
tree4189ab10a73ecca7b0232ae8e5ce817c73d6ec4a /COPYING
parentf7939e1eb8de872933fc2e3fa9934aa55567a541 (diff)
downloadlinux-stable-96894152592785638ba49e3a55c5bc218aafc49e.tar.gz
linux-stable-96894152592785638ba49e3a55c5bc218aafc49e.tar.bz2
linux-stable-96894152592785638ba49e3a55c5bc218aafc49e.zip
lzo: check for length overrun in variable length encoding.
commit 72cf90124e87d975d0b2114d930808c58b4c05e4 upstream. This fix ensures that we never meet an integer overflow while adding 255 while parsing a variable length encoding. It works differently from commit 206a81c ("lzo: properly check for overruns") because instead of ensuring that we don't overrun the input, which is tricky to guarantee due to many assumptions in the code, it simply checks that the cumulated number of 255 read cannot overflow by bounding this number. The MAX_255_COUNT is the maximum number of times we can add 255 to a base count without overflowing an integer. The multiply will overflow when multiplying 255 by more than MAXINT/255. The sum will overflow earlier depending on the base count. Since the base count is taken from a u8 and a few bits, it is safe to assume that it will always be lower than or equal to 2*255, thus we can always prevent any overflow by accepting two less 255 steps. This patch also reduces the CPU overhead and actually increases performance by 1.1% compared to the initial code, while the previous fix costs 3.1% (measured on x86_64). The fix needs to be backported to all currently supported stable kernels. Reported-by: Willem Pinckaers <willem@lekkertech.net> Cc: "Don A. Bailey" <donb@securitymouse.com> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions