DECR macro signedness

Steve Dispensa dispensa at
Tue Jan 12 07:12:32 CET 2010

Sorry if this is well known (I suspect it is, based on some of the code), but DECR_LEN and friends have an integer underflow problem if they're passed unsigned quantities. Spot-checking the code shows that it's generally called with signed quantities, but I didn't see any documentation pointing out the problem.

Here's a patch if you want it; it uses the C99 intmax_t type to make a signed copy of the potentially unsigned argument for the negativity test.

Apologies if this is old news.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20100112/0c18af10/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: decr_patch
Type: application/octet-stream
Size: 1050 bytes
Desc: decr_patch
URL: </pipermail/attachments/20100112/0c18af10/attachment.obj>

More information about the Gnutls-devel mailing list