[tor-bugs] #21134 [Core Tor/Tor]: Fail if file is too large to mmap.

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Jan 12 19:01:07 UTC 2017


#21134: Fail if file is too large to mmap.
---------------------------+------------------------------------
 Reporter:  junglefowl     |          Owner:
     Type:  defect         |         Status:  needs_information
 Priority:  Medium         |      Milestone:  Tor: 0.3.0.x-final
Component:  Core Tor/Tor   |        Version:  Tor: 0.2.9.8
 Severity:  Normal         |     Resolution:
 Keywords:  tor_mmap_file  |  Actual Points:
Parent ID:                 |         Points:
 Reviewer:                 |        Sponsor:
---------------------------+------------------------------------

Comment (by junglefowl):

 ---
 #include <stdint.h>
 #include <stdio.h>

 int
 main(void)
 {
         printf("size_t: %d\n", sizeof(size_t));
         printf("off_t: %d\n", sizeof(off_t));

         return 0;
 }
 ---

 If you compile this code with -D_FILE_OFFSET_BITS=64 (large file support),
 32 bit systems will use 4 bytes for size_t and 8 bytes for off_t:

 $ uname -m
 i686
 $ gcc -o sizes sizes.c
 $ ./sizes
 size_t: 4
 off_t: 4
 $ gcc -D_FILE_OFFSET_BITS=64 -o sizes sizes.c
 $ ./sizes
 size_t: 4
 off_t: 8

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


More information about the tor-bugs mailing list