[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #2352 [Tor Client]: more size_t_ceiling fun
#2352: more size_t_ceiling fun
------------------------+---------------------------------------------------
Reporter: arma | Owner:
Type: defect | Status: needs_review
Priority: normal | Milestone: Tor: 0.2.2.x-final
Component: Tor Client | Version:
Keywords: | Parent:
------------------------+---------------------------------------------------
Comment(by cypherpunks):
{{{
tor_assert(len < INT_MAX && len < SIZE_T_CEILING);
}}}
len is ssize_t (signed).
Hopes no one platform defines those constants as unsigned.
Except it does Tor, for missed defines:
{{{
#ifndef INT32_MAX
#define INT32_MAX 0x7fffffffu
}}}
{{{
#ifndef SSIZE_T_MAX
#if (SIZEOF_SIZE_T == 4)
#define SSIZE_T_MAX INT32_MAX
}}}
Fix:
{{{
tor_assert(len < (ssize_t)INT_MAX && len < (ssize_t)SIZE_T_CEILING);
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/2352#comment:6>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs