tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: strsuftoi(3), strsuftou(3) proposal in libc
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
On 29.10.2015 16:42, J. Lewis Muir wrote:
> On 10/28/15 9:41 PM, Kamil Rytarowski wrote:
>> The code checking for overflows in multiplication is quite
>> complicated, I'm attaching just the comments to follow the
>> algorithm:
>
> Hi, Kamil.
>
> You probably don't want to fix typos in the existing comments
> (i.e. src/lib/libutil/login_cap.c), but here are three minor
> corrections if you (or anyone else) want to fix them:
>
>> /* * First check the magnitude of each number. If the sum of
>> the * magnatude is way to high, reject the number. (If this
>> test * is not done then the first multiply below may overflow.)
>> */
>
> * "magnatude" -> "magnitude"
>
> * "way to high" -> "too high"
>
>> * Finally, if MAX - ((h1 * l2) + (l1 * h2) + (l1 * l2))<(h1*h2) *
>> then adding in residual amout will cause an overflow.
>
> * "amout" -> "amount"
>
> Regards,
>
> Lewis
>
I committed your changes, even so this code (including comments) might
be gone soon.
Thank you!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJWMoDEAAoJEEuzCOmwLnZscpUP/2NrvLMd4XaBsX42oyKSOpsf
dm6XlFyq7KG6zzRKgjgZTJ+SRODIMd2MJg3MPWsAab7siUUVzmH+c9FAI42HykHn
SJEv0FQEuhX6P1vdxyfSyd0QwVDRUw7crN7HqL5SnTSfwgQ/c6rP0v8fc+p1T8si
9Il3M9YoOi22Eo6nQuy4S7HkEn4YiBLDP2qGZzAExRN6aBmKgIjiWnrd0Zo7G7dU
s/3uv5yBaruPRSDxzGdY4qHzxg4tip9G6U0zUE7g4NSo7nbtVLNhwQdQA7v5cHmu
JT7Ny5FTEn/ZFnvw+Ol9VCIXhJn6HjjObzplLiV37JUeHFXNGiI6XipGTWA2tHJC
K11GYvV0KGNokfbem7JI3EqmBHe8bsnjBCK5NU8OQ58IFaoSGu4GkhQw/ELM88Y6
rs6AwE45VrVpToeQCSc3fUmD9bRWnkTNC3bmifWYrQH35INjf/P1eth52yns8mkp
H9wgkorfJsf/vnPblMesA3HPgTKMlpNE4Gce1B+g0EAohzYU0cteN8E+jnzXVSOz
xXq4dNqnn8rCUFLM6AN1yN07UGK6bCUp0wPmLvVISzGe15wyk8kEjap18R7dkeu/
9Vl6KntobjJlcMXdV7QIeK0jc6lHYh0FRUk5jYpo4YEZXbgeKtyef1yPWEoCRPYK
NhvYPPd+RJRAUhImniPD
=Xssr
-----END PGP SIGNATURE-----
Home |
Main Index |
Thread Index |
Old Index