From: Andreas Gruenbacher Date: Fri, 8 Jan 2010 13:40:00 +0000 (+0100) Subject: base85: Make the code more obvious instead of explaining the non-obvious X-Git-Tag: v1.6.5.8~5^2^2^2^2^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0606c36a73449e76d8f6133253c1eff291ee8c97;p=git.git base85: Make the code more obvious instead of explaining the non-obvious Here is another cleanup ... Signed-off-by: Andreas Gruenbacher Signed-off-by: Junio C Hamano --- diff --git a/base85.c b/base85.c index f2b9a24d5..24ddf60eb 100644 --- a/base85.c +++ b/base85.c @@ -57,14 +57,8 @@ int decode_85(char *dst, const char *buffer, int len) de = de85[ch]; if (--de < 0) return error("invalid base85 alphabet %c", ch); - /* - * Detect overflow. The largest - * 5-letter possible is "|NsC0" to - * encode 0xffffffff, and "|NsC" gives - * 0x03030303 at this point (i.e. - * 0xffffffff = 0x03030303 * 85). - */ - if (0x03030303 < acc || + /* Detect overflow. */ + if (0xffffffff / 85 < acc || 0xffffffff - de < (acc *= 85)) return error("invalid base85 sequence %.5s", buffer-5); acc += de;