[tor-bugs] #27740 [Core Tor/Tor]: rust protover_all_supported() returns rust-allocated string in *missing_out

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Sep 21 00:22:39 UTC 2018


#27740: rust protover_all_supported() returns rust-allocated string in *missing_out
-------------------------------------------------+-------------------------
 Reporter:  cyberpunks                           |          Owner:  (none)
     Type:  defect                               |         Status:  new
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.5.x-final
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.3.3.1-alpha
 Severity:  Normal                               |     Resolution:
 Keywords:  rust, protover, memory-safety,       |  Actual Points:
  035-must, fast-fix, 033-backport,              |
  034-backport                                   |
Parent ID:                                       |         Points:
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by teor):

 Replying to [comment:5 cyberpunks]:
 > Replying to [comment:3 teor]:
 > > As far as I understand it, it may be ok to allocate in Rust and
 deallocate in C, as long as they use the same allocator.
 > Oh right. Of course currently, they don't.

 We have allocate_and_copy_string() in Rust, which uses tor_malloc():
 https://github.com/torproject/tor/blob/master/src/rust/tor_allocate/tor_allocate.rs#L30

 We need to update our RustCodingStandards.md to mention
 allocate_and_copy_string():
 https://gitweb.torproject.org/tor.git/tree/doc/HACKING/CodingStandardsRust.md#n374

 I'll open another ticket.

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


More information about the tor-bugs mailing list