commit | 9df03441d0d15ed0ce3f4301f27d5cbc982dcb0f | [log] [tgz] |
---|---|---|
author | Simon Butcher <simon.butcher@arm.com> | Thu Feb 02 08:46:53 2017 +0000 |
committer | Simon Butcher <simon.butcher@arm.com> | Sun Feb 05 01:01:44 2017 +0000 |
tree | 0fa13d85269fc0c73afcb43a3bd01248ac0cb53c | |
parent | a540090142906300810c018852aeaa0c1236a608 [diff] [blame] |
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 305afc5..f06b57b 100644 --- a/library/base64.c +++ b/library/base64.c
@@ -192,6 +192,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;