[tor-bugs] #8415 [Core Tor/Tor]: Use event_set_mem_functions

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Sep 7 07:20:05 UTC 2018


#8415: Use event_set_mem_functions
------------------------------------------+--------------------------------
 Reporter:  nickm                         |          Owner:  rl1987
     Type:  enhancement                   |         Status:  needs_revision
 Priority:  Medium                        |      Milestone:  Tor:
                                          |  0.3.5.x-final
Component:  Core Tor/Tor                  |        Version:
 Severity:  Normal                        |     Resolution:
 Keywords:  easy backend libevent malloc  |  Actual Points:
Parent ID:                                |         Points:
 Reviewer:                                |        Sponsor:
------------------------------------------+--------------------------------

Comment (by teor):

 We can't ignore warnings, they make our CI and development environments
 fail. (We set --enable-gcc-warnings, which turns all warnings into
 errors.)

 I think your box might have gcc 8, which recently started warning about
 function casts. I'm surprised that the Appveyor CI didn't fail on this
 code, because it also has gcc 8. (But it has existing failures, see
 #27389.)

 I don't think it's safe to pass a different number of arguments than the
 caller expects:
 {{{
                expected ‘void * (*)(size_t,  const char *, int) {aka void
 * (*)(long unsigned int,  const char *, int)}’
 but argument is of type ‘void * (*)(size_t) {aka void * (*)(long unsigned
 int)}’
 }}}

 I suspect that the extra arguments are the location in the code of the
 function call (`__FILE__, __LINE__`). Check the OpenSSL documentation for
 the callback.

 Since it's a callback, the file and line are less useful. And we have
 backtraces on most systems.

 You could see if tor has another malloc function that takes file and line.
 If not, write a wrapper that ignores them, and calls tor_malloc().

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/8415#comment:17>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list