summaryrefslogtreecommitdiffstats
path: root/test/d2i_test.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-04-22 18:37:42 +0100
committerDr. Stephen Henson <steve@openssl.org>2016-04-23 00:29:03 +0100
commit53e409db615550c4bf5da2c9a5f56c7065315636 (patch)
treefee28e7f0064fa3dc5af6883de5c7f7d7c526dda /test/d2i_test.c
parentc62981390d6cf9e3d612c489b8b77c2913b25807 (diff)
In d2i_test return error for malloc failure.
Bad ASN.1 data should never be able to trigger a malloc failure so return an error in d2i_test if a malloc failure occurs. Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'test/d2i_test.c')
-rw-r--r--test/d2i_test.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/d2i_test.c b/test/d2i_test.c
index 49882a3828..78adf489dd 100644
--- a/test/d2i_test.c
+++ b/test/d2i_test.c
@@ -108,6 +108,9 @@ static int execute_test(D2I_TEST_FIXTURE fixture)
ret = 1;
err:
+ /* Don't indicate success for memory allocation errors */
+ if (ret == 1 && ERR_GET_REASON(ERR_peek_error()) == ERR_R_MALLOC_FAILURE)
+ ret = 0;
BIO_free(bio);
OPENSSL_free(der);
ASN1_item_free(value, item_type);