✘ Bad Patch: nteger handling issues (SIGN_EXTENSION).
Eric S. Raymond
esr at thyrsus.com
Thu May 11 18:37:53 UTC 2017
Gary E. Miller via devel <devel at ntpsec.org>:
> Yo Eric!
>
> Commits:
> 0ecdf682 by Eric S. Raymond at 2017-05-11T14:10:41-04:00
> Address Coverity CID 161765: Integer handling issues (SIGN_EXTENSION).
>
> Bad patch:
>
> ../../libparse/binio.c: In function 'get_lsb_ulong':
> ../../libparse/binio.c:43:10: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
> retval |= *((*bufpp)++) << 8;
> ^~
> ../../libparse/binio.c:44:10: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
> retval |= *((*bufpp)++) << 16;
> ^~
> ../../libparse/binio.c:45:10: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
> retval |= *((*bufpp)++) << 24;
I don't suppose it will surprise you to hear that I'm not seeing those warnings.
Do you have any good ideas about how to fix them? Please don't just go backward;
Coverity was clearly right about the previous cast of the return value being
broken.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
Please consider contributing to my Patreon page at https://www.patreon.com/esr
so I can keep the invisible wheels of the Internet turning. Give generously -
the civilization you save might be your own.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: not available
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20170511/36758550/attachment.bin>
More information about the devel
mailing list