summaryrefslogtreecommitdiff
path: root/src/common/util.h
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2015-01-15 14:36:24 +0000
committerGeorge Kadianakis <desnacked@riseup.net>2015-01-15 14:43:58 +0000
commit45bc5a07434376c0d801a547b38893d85a515b49 (patch)
tree3569b85366fbfabc6db75a3df054990e13a5ea59 /src/common/util.h
parent3668a4126e0c2502a77c2ba5d7885add489a964a (diff)
downloadtor-45bc5a07434376c0d801a547b38893d85a515b49.tar.gz
tor-45bc5a07434376c0d801a547b38893d85a515b49.zip
Restrict sample values of the Laplace distribution to int64_t.
This helps avoid undefined behavior from casting big double values to int64_t. Fixes #14090.
Diffstat (limited to 'src/common/util.h')
-rw-r--r--src/common/util.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/common/util.h b/src/common/util.h
index 1b8fc74db5..89c140032a 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -173,7 +173,7 @@ unsigned round_to_next_multiple_of(unsigned number, unsigned divisor);
uint32_t round_uint32_to_next_multiple_of(uint32_t number, uint32_t divisor);
uint64_t round_uint64_to_next_multiple_of(uint64_t number, uint64_t divisor);
int64_t round_int64_to_next_multiple_of(int64_t number, int64_t divisor);
-double sample_laplace_distribution(double mu, double b, double p);
+int64_t sample_laplace_distribution(double mu, double b, double p);
int64_t add_laplace_noise(int64_t signal, double random, double delta_f,
double epsilon);
int n_bits_set_u8(uint8_t v);