[tor-bugs] #31948 [Core Tor/Tor]: CID 1454593: passing negative value to memset

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Oct 3 11:20:11 UTC 2019


#31948: CID 1454593: passing negative value to memset
------------------------------+---------------------------------
     Reporter:  nickm         |      Owner:  nickm
         Type:  defect        |     Status:  assigned
     Priority:  Medium        |  Milestone:  Tor: 0.4.2.x-final
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:  fast-fix 042-should
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+---------------------------------
 Coverity says:
 {{{
 ________________________________________________________________________________________________________
 *** CID 1454593:  Memory - illegal accesses  (NO_EFFECT)
 /src/test/test_util.c: 6200 in test_util_map_anon_nofork()
 6194       int pipefd[2] = {-1, -1};
 6195       unsigned inherit=0;
 6196
 6197       tor_munmap_anonymous(ptr, sz);
 6198       ptr = tor_mmap_anonymous(sz, ANONMAP_NOINHERIT, &inherit);
 6199       tt_ptr_op(ptr, OP_NE, 0);
 >>>     CID 1454593:  Memory - illegal accesses  (NO_EFFECT)
 >>>     Argument "-48" in "memset" loses precision in "memset(ptr, -48,
 sz)".
 6200       memset(ptr, TEST_VALUE, sz);
 6201
 6202       tt_int_op(0, OP_EQ, pipe(pipefd));
 6203       pid_t child = fork();
 6204       if (child == 0) {
 6205         /* We're in the child. */
 }}}

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


More information about the tor-bugs mailing list