Remove OPENSSL_assert() from crypto/asn1/bio_asn1.c
authorMatt Caswell <matt@openssl.org>
Wed, 21 Jun 2017 14:51:27 +0000 (15:51 +0100)
committerMatt Caswell <matt@openssl.org>
Mon, 21 Aug 2017 07:44:44 +0000 (08:44 +0100)
Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3740)

crypto/asn1/bio_asn1.c

index 31fd7258a9ab2c7494cb4a7141bbbeedb9a0236f..e28ab27767ab23b1cbb6668b4635c3540b1ed8fd 100644 (file)
@@ -16,6 +16,7 @@
 #include <string.h>
 #include <internal/bio.h>
 #include <openssl/asn1.h>
+#include "internal/cryptlib.h"
 
 /* Must be large enough for biggest tag+length */
 #define DEFAULT_ASN1_BUF_SIZE 20
@@ -181,7 +182,8 @@ static int asn1_bio_write(BIO *b, const char *in, int inl)
 
         case ASN1_STATE_HEADER:
             ctx->buflen = ASN1_object_size(0, inl, ctx->asn1_tag) - inl;
-            OPENSSL_assert(ctx->buflen <= ctx->bufsize);
+            if (!ossl_assert(ctx->buflen <= ctx->bufsize))
+                return 0;
             p = ctx->buf;
             ASN1_put_object(&p, 0, inl, ctx->asn1_tag, ctx->asn1_class);
             ctx->copylen = inl;