@@ -1037,6 +1037,8 @@ test_bson_json_read_corrupt_utf8 (void)
1037
1037
BSON_JSON_ERROR_READ_CORRUPT_JS ,
1038
1038
"invalid bytes in UTF8 string" );
1039
1039
1040
+ memset (& error , 0 , sizeof error );
1041
+
1040
1042
BSON_ASSERT (!bson_new_from_json ((uint8_t * ) bad_value , -1 , & error ));
1041
1043
ASSERT_ERROR_CONTAINS (error ,
1042
1044
BSON_ERROR_JSON ,
@@ -1148,6 +1150,8 @@ test_bson_json_read_legacy_regex (void)
1148
1150
BSON_JSON_ERROR_READ_INVALID_PARAM ,
1149
1151
"Missing \"$options\" after \"$regex\"" );
1150
1152
1153
+ memset (& error , 0 , sizeof error );
1154
+
1151
1155
r = bson_init_from_json (& b , "{\"a\": {\"$options\": \"ix\"}}" , -1 , & error );
1152
1156
BSON_ASSERT (!r );
1153
1157
ASSERT_ERROR_CONTAINS (error ,
@@ -1230,6 +1234,8 @@ test_bson_json_read_binary (void)
1230
1234
BSON_JSON_ERROR_READ_INVALID_PARAM ,
1231
1235
"Missing \"base64\" after \"subType\"" );
1232
1236
1237
+ memset (& error , 0 , sizeof error );
1238
+
1233
1239
/* no subType */
1234
1240
r = bson_init_from_json (
1235
1241
& b , "{\"b\": {\"$binary\": {\"base64\": \"Zm9v\"}}}" , -1 , & error );
@@ -1514,6 +1520,8 @@ test_bson_json_number_long (void)
1514
1520
BSON_JSON_ERROR_READ_INVALID_PARAM ,
1515
1521
"Number \"9223372036854775808\" is out of range" );
1516
1522
1523
+ memset (& error , 0 , sizeof error );
1524
+
1517
1525
/* INT64_MIN - 1 */
1518
1526
r = bson_init_from_json (
1519
1527
& b , "{\"x\": {\"$numberLong\": \"-9223372036854775809\"}}" , -1 , & error );
@@ -1524,6 +1532,8 @@ test_bson_json_number_long (void)
1524
1532
BSON_JSON_ERROR_READ_INVALID_PARAM ,
1525
1533
"Number \"-9223372036854775809\" is out of range" );
1526
1534
1535
+ memset (& error , 0 , sizeof error );
1536
+
1527
1537
r = bson_init_from_json (
1528
1538
& b , "{\"x\": {\"$numberLong\": \"10000000000000000000\"}}" , -1 , & error );
1529
1539
@@ -1533,6 +1543,8 @@ test_bson_json_number_long (void)
1533
1543
BSON_JSON_ERROR_READ_INVALID_PARAM ,
1534
1544
"Number \"10000000000000000000\" is out of range" );
1535
1545
1546
+ memset (& error , 0 , sizeof error );
1547
+
1536
1548
/* INT64_MIN - 2 */
1537
1549
r = bson_init_from_json (& b , "{\"x\": -10000000000000000000}" , -1 , & error );
1538
1550
@@ -2035,6 +2047,8 @@ test_bson_json_int64 (void)
2035
2047
BSON_JSON_ERROR_READ_INVALID_PARAM ,
2036
2048
"Number \"9223372036854775808\" is out of range" );
2037
2049
2050
+ memset (& error , 0 , sizeof error );
2051
+
2038
2052
/* INT64_MIN - 1 */
2039
2053
BSON_ASSERT (
2040
2054
!bson_init_from_json (& b , "{ \"x\": -9223372036854775809 }" , -1 , & error ));
@@ -2043,13 +2057,17 @@ test_bson_json_int64 (void)
2043
2057
BSON_JSON_ERROR_READ_INVALID_PARAM ,
2044
2058
"Number \"-9223372036854775809\" is out of range" );
2045
2059
2060
+ memset (& error , 0 , sizeof error );
2061
+
2046
2062
BSON_ASSERT (
2047
2063
!bson_init_from_json (& b , "{ \"x\": 10000000000000000000 }" , -1 , & error ));
2048
2064
ASSERT_ERROR_CONTAINS (error ,
2049
2065
BSON_ERROR_JSON ,
2050
2066
BSON_JSON_ERROR_READ_INVALID_PARAM ,
2051
2067
"Number \"10000000000000000000\" is out of range" );
2052
2068
2069
+ memset (& error , 0 , sizeof error );
2070
+
2053
2071
/* INT64_MIN - 2 */
2054
2072
BSON_ASSERT (!bson_init_from_json (
2055
2073
& b , "{ \"x\": -10000000000000000000 }" , -1 , & error ));
@@ -2134,6 +2152,7 @@ test_bson_json_double_overflow (void)
2134
2152
"out of range" );
2135
2153
2136
2154
bson_free (j );
2155
+ memset (& error , 0 , sizeof error );
2137
2156
2138
2157
/* same test with canonical Extended JSON */
2139
2158
j = bson_strdup_printf ("{ \"d\" : { \"$numberDouble\" : \"%s\" } }" , * p );
@@ -2188,6 +2207,7 @@ test_bson_json_nan (void)
2188
2207
BSON_ERROR_JSON ,
2189
2208
BSON_JSON_ERROR_READ_CORRUPT_JS ,
2190
2209
"Got parse error at" );
2210
+ memset (& error , 0 , sizeof error );
2191
2211
}
2192
2212
2193
2213
for (j = partial ; * j ; j ++ ) {
@@ -2196,6 +2216,7 @@ test_bson_json_nan (void)
2196
2216
BSON_ERROR_JSON ,
2197
2217
BSON_JSON_ERROR_READ_CORRUPT_JS ,
2198
2218
"Incomplete JSON" );
2219
+ memset (& error , 0 , sizeof error );
2199
2220
}
2200
2221
}
2201
2222
@@ -2253,6 +2274,7 @@ test_bson_json_infinity (void)
2253
2274
BSON_ERROR_JSON ,
2254
2275
BSON_JSON_ERROR_READ_CORRUPT_JS ,
2255
2276
"Got parse error at" );
2277
+ memset (& error , 0 , sizeof error );
2256
2278
}
2257
2279
2258
2280
for (j = partial ; * j ; j ++ ) {
@@ -2261,6 +2283,7 @@ test_bson_json_infinity (void)
2261
2283
BSON_ERROR_JSON ,
2262
2284
BSON_JSON_ERROR_READ_CORRUPT_JS ,
2263
2285
"Incomplete JSON" );
2286
+ memset (& error , 0 , sizeof error );
2264
2287
}
2265
2288
}
2266
2289
@@ -2758,6 +2781,7 @@ test_bson_json_null_in_str (void)
2758
2781
(const uint8_t * ) bad_json , sizeof (bad_json ) - 1 , & err ));
2759
2782
ASSERT_ERROR_CONTAINS (
2760
2783
err , BSON_ERROR_JSON , BSON_JSON_ERROR_READ_CORRUPT_JS , "Got parse error" );
2784
+ memset (& err , 0 , sizeof err );
2761
2785
ASSERT (!bson_new_from_json (
2762
2786
(const uint8_t * ) cdriver2305 , sizeof (cdriver2305 ) - 1 , & err ));
2763
2787
ASSERT_ERROR_CONTAINS (
0 commit comments