Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Trac Trac
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Service Desk
    • Milestones
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
  • Wiki
    • Wiki
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • Legacy
  • TracTrac
  • Issues
  • #455
Closed (moved) (moved)
Open
Issue created Jul 08, 2007 by Trac@tracbot

tor segfaults on 64k-aligned cached-routers file

This bug is for svn and the 0.1.2.x tree, which are both affected.

When Tor gets to the end of an 4k-aligned file (page size?), it segfaults in eat_whitespace()

The problem is imminent at routerparse.c:899 when both end and eos are out of bounds. (eos is (always?) out of bounds when the mmap is page-aligned.) Execution then enters router_parse_entry_from_string(), which calls tokenize_string(s, end...) with end out of bounds. That calls eat_whitespace, which is not safe for non-null-terminated strings (as it has no end pointer or length specifier).

Steps to reproduce:

  1. minimal torrc with RunAsDaemon 0, DataDirectory /some/path/ which points to...
  2. A valid 4096-byte (I've only tested with 2!^x * 4096-byte files) cached-routers file (below, or take an existing cached-routers file and chop it, then duplicate/remove/modify exit policy entries until you get to an appropriate size)

I've collected sample cached-routers files of the obvious sizes that seems to trigger the bug on both my x86 and x86-64 machines. http://70.242.110.86/svn/cr/

The crashes I get are in eat_whitespace(), but the original reporter on IRC was seeing segfaults in 0.1.2.14, routerparse.c:679 -- on PPC. A representative backtrace from his PPC is at http://www.pastebin.ca/608408 One with a segfault in eat_whitespace (on x86-64) is at http://www.pastebin.ca/608454

[Automatically added by flyspray2trac: Operating System: All]

Trac:
Username: croup

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking