[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #17827 [Tor]: Different return type of backtrace function on FreeBSD
#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:
---------------------------------------+-----------------------------------
Comment (by teor):
Replying to [comment:3 cypherpunks]:
> The FreeBSD versions of `backtrace_symbols` and `backtrace_symbols_fd`
also expect their `len` parameter to be `size_t`. So we need to make sure
`depth` is larger than zero to prevent overflow issues.
We already set MAX_DEPTH to 256, so anything outside the range 0 <= len <=
MAX_DEPTH is an error. (If that happens, we should probably assert, or
return from the function.)
This means that we could use size_t (or long) for len instead of int. Then
we'd have no shortening warnings.
We could also change the type of depth in the clean_backtrace arguments,
and therefore the type of depth in sigsys_debugging.
I think this is the best way to patch this issue, rather than casting - it
expresses the intended range of depth / len more clearly than a cast.
But I'd also happily take a patch that used casts to silence the warnings.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/17827#comment:4>
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