[tor-bugs] #17827 [Tor]: Different return type of backtrace function on FreeBSD
Tor Bug Tracker & Wiki
blackhole at torproject.org
Mon Dec 14 17:40:58 UTC 2015
#17827: Different return type of backtrace function on FreeBSD
---------------------------------------+-----------------------------------
Reporter: cypherpunks | Owner:
Type: defect | Status: new
Priority: Medium | Milestone: Tor:
Component: Tor | 0.2.8.x-final
Severity: Normal | Version:
Keywords: 027-backport freebsd easy | Resolution:
Parent ID: | Actual Points:
Sponsor: | Points:
---------------------------------------+-----------------------------------
Changes (by nickm):
* keywords: => 027-backport freebsd easy
Comment:
Replying to [comment:1 teor]:
> We can probably just use a cast to int to avoid this issue, as long as
we're sure the return value fits in an int.
>
> What's the range of the return value?
The Linux manpage says
{{{
int backtrace(void **buffer, int size);
....
backtrace() returns the number of addresses returned in buffer,
which
is not greater than size.
}}}
FreeBSD says
{{{
size_t
backtrace(void **addrlist, size_t len);
...
The backtrace() function returns the number of elements that were
filled
in the backtrace.
}}}
So either way, if we pass something less than INT_MAX in, we get something
less than int_max out.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/17827#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list