[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #23523 [Core Tor/Tor]: Handle extreme values better in add_laplace_noise()
#23523: Handle extreme values better in add_laplace_noise()
-------------------------------------------------+-------------------------
Reporter: teor | Owner: teor
Type: defect | Status:
| needs_revision
Priority: Medium | Milestone: Tor:
| 0.3.3.x-final
Component: Core Tor/Tor | Version: Tor:
| 0.2.6.2-alpha
Severity: Normal | Resolution:
Keywords: tor-relay, privcount, review- | Actual Points:
group-24 |
Parent ID: #23061 | Points: 0.5
Reviewer: catalyst | Sponsor:
| SponsorQ
-------------------------------------------------+-------------------------
Changes (by teor):
* status: needs_review => needs_revision
Comment:
Replying to [comment:10 catalyst]:
> I'm still looking over this. One thing that sticks out is that the
comment in `get_min_safe_noise()` is inaccurate and caused me to
misinterpret what it's actually doing on platforms with `DBL_MANT_DIG`
less than 64. It might be more correct to say "This is always safe,
because floating point numbers are sign-magnitude and the negation of an
exact number is also exact."
All the types here are int64_t.
But I agree the comment is confusing, particularly after I added a case
that actually returns +/-INT64_MAX.
Let's change it to:
{{{
tor_assert(get_max_safe_noise() >= 0);
/* This is safe as long as get_max_safe_noise() is in 0..INT64_MAX,
because -INT64_MAX..0 are representable as an int64_t. */
return -get_max_safe_noise();
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/23523#comment:11>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs