Skip to content
GitLab
  • Menu
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
  • #2352
Closed (moved) (moved)
Open
Created Jan 05, 2011 by Roger Dingledine@arma

more size_t_ceiling fun

<doorss> need to replace "if (tok->object_size >= INT_MAX) {"
<doorss> with "if (tok->object_size >= SIZE_T_CEILING || tok->object_size >= INT_MAX) {"
<doorss> for two places.
<doorss> if it can be >= INT_MAX it can be INT_MAX - 1 too.
<doorss> "tok->object_body = ALLOC(next-*s); /* really, this is too much RAM. */" is fragile too. no checks, utill assert.

> doorss: which branch are you looking at?
<doorss> it was master.

<doorss> "if (tok->object_size >= INT_MAX)" mostly about cast to int. but if size can be such big (no assert here) so need to check for SIZE_T_CEILING.
<doorss> it prevents overflow underflow and another truncates during "sig->signature_len = (int) tok->object_size"
<doorss> SIZE_T_CEILING < INT_MAX for 32bit size_t
<doorss> if tok->object_size == INT_MAX - 1 then "sig->signature = tor_memdup(tok->object_body, tok->object_size)" trigger assert for 32 bit.
<doorss> we can't just replace INT_MAX with SIZE_T_CEILING. for 64 bit.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking