diff options
author | Andy Polyakov <appro@openssl.org> | 2017-04-28 21:14:36 +0200 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2017-04-30 15:18:47 +0200 |
commit | 1ff86c5efa946427e20b3504c460e83edbe53905 (patch) | |
tree | 34ea0925660f990c32a15d2461c11f0449680ecb /test | |
parent | 1e93d619b78832834ae32f5c0c1b0e466267f72d (diff) |
test/asn1_encode_test.c: test "next negative minimum" corner case.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/asn1_encode_test.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/asn1_encode_test.c b/test/asn1_encode_test.c index 7d762ae3c2..0c3a196d0b 100644 --- a/test/asn1_encode_test.c +++ b/test/asn1_encode_test.c @@ -41,6 +41,9 @@ static unsigned char t_one[] = { static unsigned char t_one_neg[] = { 0xff }; +static unsigned char t_minus_256[] = { + 0xff, 0x00 +}; static unsigned char t_longundef[] = { 0x7f, 0xff, 0xff, 0xff }; @@ -99,6 +102,7 @@ static TEST_CUSTOM_DATA test_custom_data[] = { CUSTOM_DATA(t_longundef), CUSTOM_DATA(t_one), CUSTOM_DATA(t_one_neg), + CUSTOM_DATA(t_minus_256), CUSTOM_DATA(t_9bytes_1), CUSTOM_DATA(t_8bytes_1), CUSTOM_DATA(t_8bytes_2), @@ -200,6 +204,7 @@ static ASN1_LONG_DATA long_expected_32bit[] = { { 0, 0, 0 }, { 0xff, 1, 0x7fffffff }, /* t_longundef */ CUSTOM_EXPECTED_SUCCESS(1, 1), /* t_one */ CUSTOM_EXPECTED_SUCCESS(-1, -1), /* t_one_neg */ + CUSTOM_EXPECTED_SUCCESS(-256, -256), /* t_minus_256 */ CUSTOM_EXPECTED_FAILURE, /* t_9bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_2 */ @@ -235,6 +240,7 @@ static ASN1_LONG_DATA long_expected_64bit[] = { { 0, 0, 0 }, { 0xff, 1, 0x7fffffff }, /* t_longundef */ CUSTOM_EXPECTED_SUCCESS(1, 1), /* t_one */ CUSTOM_EXPECTED_SUCCESS(-1, -1), /* t_one_neg */ + CUSTOM_EXPECTED_SUCCESS(-256, -256), /* t_minus_256 */ CUSTOM_EXPECTED_FAILURE, /* t_9bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_1 */ CUSTOM_EXPECTED_SUCCESS(LONG_MAX, LONG_MAX), /* t_8bytes_2 */ @@ -287,6 +293,7 @@ static ASN1_INT32_DATA int32_expected[] = { CUSTOM_EXPECTED_SUCCESS(ASN1_LONG_UNDEF, ASN1_LONG_UNDEF), /* t_zero */ CUSTOM_EXPECTED_SUCCESS(1, 1), /* t_one */ CUSTOM_EXPECTED_SUCCESS(-1, -1), /* t_one_neg */ + CUSTOM_EXPECTED_SUCCESS(-256, -256), /* t_minus_256 */ CUSTOM_EXPECTED_FAILURE, /* t_9bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_2 */ @@ -334,6 +341,7 @@ static ASN1_UINT32_DATA uint32_expected[] = { CUSTOM_EXPECTED_SUCCESS(ASN1_LONG_UNDEF, ASN1_LONG_UNDEF), /* t_zero */ CUSTOM_EXPECTED_SUCCESS(1, 1), /* t_one */ CUSTOM_EXPECTED_FAILURE, /* t_one_neg (illegal negative value) */ + CUSTOM_EXPECTED_FAILURE, /* t_minus_256 (illegal negative value) */ CUSTOM_EXPECTED_FAILURE, /* t_9bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_2 */ @@ -381,6 +389,7 @@ static ASN1_INT64_DATA int64_expected[] = { CUSTOM_EXPECTED_SUCCESS(ASN1_LONG_UNDEF, ASN1_LONG_UNDEF), /* t_zero */ CUSTOM_EXPECTED_SUCCESS(1, 1), /* t_one */ CUSTOM_EXPECTED_SUCCESS(-1, -1), /* t_one_neg */ + CUSTOM_EXPECTED_SUCCESS(-256, -256), /* t_minus_256 */ CUSTOM_EXPECTED_FAILURE, /* t_9bytes_1 */ CUSTOM_EXPECTED_FAILURE, /* t_8bytes_1 (too large positive) */ CUSTOM_EXPECTED_SUCCESS(INT64_MAX, INT64_MAX), /* t_8bytes_2 */ @@ -429,6 +438,7 @@ static ASN1_UINT64_DATA uint64_expected[] = { CUSTOM_EXPECTED_SUCCESS(ASN1_LONG_UNDEF, ASN1_LONG_UNDEF), /* t_zero */ CUSTOM_EXPECTED_SUCCESS(1, 1), /* t_one */ CUSTOM_EXPECTED_FAILURE, /* t_one_neg (illegal negative value) */ + CUSTOM_EXPECTED_FAILURE, /* t_minus_256 (illegal negative value) */ CUSTOM_EXPECTED_FAILURE, /* t_9bytes_1 */ CUSTOM_EXPECTED_SUCCESS((uint64_t)INT64_MAX+1, (uint64_t)INT64_MAX+1), /* t_8bytes_1 */ |