commit | 410bc115ec4236936e2966a59079ea4facb89ace | [log] [tgz] |
---|---|---|
author | Simon Butcher <simon.butcher@arm.com> | Thu Feb 02 08:46:53 2017 +0000 |
committer | Andres AG <andres.amayagarcia@arm.com> | Wed Feb 08 12:04:27 2017 +0000 |
tree | 46468191119921ee451f853b304bfb81d2708544 | |
parent | cde8035e570c757857e6ea5f291ad2c21b54ea3d [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 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;