aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_confparse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-09-13 18:24:15 -0400
committerNick Mathewson <nickm@torproject.org>2019-09-13 18:26:16 -0400
commitbfc5f09979d49867b373b9433edf37adce8c66dd (patch)
tree516ce31d25f082710cd511cd61e549f132566b60 /src/test/test_confparse.c
parent9d604959036bd02e7ff0ca1bd33f842664610b82 (diff)
downloadtor-bfc5f09979d49867b373b9433edf37adce8c66dd.tar.gz
tor-bfc5f09979d49867b373b9433edf37adce8c66dd.zip
Detect overflow or underflow on double config values.
Any floating point value too positive or negative to distinguish from +/-Inf, or too small to distinguish from +/-0, is an over/underflow.
Diffstat (limited to 'src/test/test_confparse.c')
-rw-r--r--src/test/test_confparse.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/test_confparse.c b/src/test/test_confparse.c
index a4da6c7c9f..f04853af72 100644
--- a/src/test/test_confparse.c
+++ b/src/test/test_confparse.c
@@ -490,6 +490,14 @@ static const badval_test_t bv_negint = { "pos -10\n", "out of bounds" };
static const badval_test_t bv_badu64 = { "u64 u64\n", "malformed" };
static const badval_test_t bv_dbl1 = { "dbl xxx\n", "Could not convert" };
static const badval_test_t bv_dbl2 = { "dbl 1.0 xx\n", "Could not convert" };
+static const badval_test_t bv_dbl3 = {
+ "dbl 1e-10000\n", "too small to express" };
+static const badval_test_t bv_dbl4 = {
+ "dbl 1e1000\n", "too large to express" };
+static const badval_test_t bv_dbl5 = {
+ "dbl -1e-10000\n", "too small to express" };
+static const badval_test_t bv_dbl6 = {
+ "dbl -1e1000\n", "too large to express" };
static const badval_test_t bv_badcsvi1 =
{ "csv_interval 10 wl\n", "malformed" };
static const badval_test_t bv_badcsvi2 =
@@ -1049,6 +1057,10 @@ struct testcase_t confparse_tests[] = {
BADVAL_TEST(badu64),
BADVAL_TEST(dbl1),
BADVAL_TEST(dbl2),
+ BADVAL_TEST(dbl3),
+ BADVAL_TEST(dbl4),
+ BADVAL_TEST(dbl5),
+ BADVAL_TEST(dbl6),
BADVAL_TEST(badcsvi1),
BADVAL_TEST(badcsvi2),
BADVAL_TEST(nonoption),