[tor-bugs] #21134 [Core Tor/Tor]: Fail if file is too large to mmap.
Tor Bug Tracker & Wiki
blackhole at torproject.org
Tue Jan 10 15:44: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:
---------------------------+------------------------------------
Changes (by dgoulet):
* status: needs_review => needs_information
Comment:
Hrm, both on 32 and 64 bit, don't `size_t` and `off_t` (st.st_size) are
the same size? If so, that `SIZE_MAX` check is only useful with "==". I do
think the `<` check is useful which would detect the overflow if the
pagesize adjustment triggers it.
{{{
if (st.st_size >= SIZE_MAX || size < st.st_size) {
}}}
This snippet gives me the same size (on 64 bit and -m32):
{{{
size_t max = SIZE_MAX;
off_t max2 = (~(off_t)0);
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/21134#comment:2>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list