Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Trac
Trac
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Issue Boards

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • Legacy
  • TracTrac
  • Issues
  • #7191

Closed (moved)
Open
Opened Oct 22, 2012 by Andrea Shepard@andrea

smartlist_bsearch_idx() is broken for short lists

Per asn:

---begin quote---

Hi Andrea,

this is a possible bug I was discussing with Nick. He is pretty busy these days, so a third set of eyes could be useful:

hi fwiw smartlist_bsearch_idx() seems a bit sloppy it doesn't handle the case where the sl is empty (smartlist_len(sl)

  • 1, underflows) and if sl has one element, there is still the danger of underflowing 'hi = mid-1;'. from what I see, the function is only used with smartlist carrying the whole routerlist, so it's "safe" till tor has only one relay. ...at which point we've got other problems, yeah. still a good idea to fix it hang on it's used in smartlist_bsearch, which is used in other places too i think smartlist_bsearch() is also only used with the whole routerlist. you mean networkstatus the routerlist is the list of routerinfo_t we know there are enough places where it's used that I think we should have more eyes looking at it before we accidentally 0day ourselves. I'll look through the code by thursday; you can also ask athena on #tor-internal if you like btw, the interface of smartlist_bsearch_idx() doesn't allow particularly elegant error handling :(

--- end quote ---

This function is broken for lists of length zero or one and doesn't check the pointer arguments for nullness properly.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Tor: 0.2.3.x-final
Milestone
Tor: 0.2.3.x-final
Assign milestone
Time tracking
None
Due date
None
Reference: legacy/trac#7191