commit | 746edf4e75e686075f0659701151582b56cb4ffb | [log] [tgz] |
---|---|---|
author | Simon Butcher <simon.butcher@arm.com> | Thu Feb 02 08:46:53 2017 +0000 |
committer | Simon Butcher <simon.butcher@arm.com> | Sat Feb 25 21:27:17 2017 +0000 |
tree | 74eea9fc73eadb92ca66a51fb67447992490e955 | |
parent | 59abd301f53d295c9a831fdcf9f97ef2878df72a [diff] |
Add comment to integer overflow fix in base64.c Adds clarifying comment to the integer overflow fix in base64.c
diff --git a/library/base64.c b/library/base64.c index 3de67f0..ba69260 100644 --- a/library/base64.c +++ b/library/base64.c
@@ -198,6 +198,10 @@ return( 0 ); } + /* The following expression is to calculate the following formula without + * risk of integer overflow in n: + * n = ( ( n * 6 ) + 7 ) >> 3; + */ n = ( 6 * ( n >> 3 ) ) + ( ( 6 * ( n & 0x7 ) + 7 ) >> 3 ); n -= j;