diff options
author | Robert Sloan <varomodt@google.com> | 2017-09-18 09:38:15 -0700 |
---|---|---|
committer | Robert Sloan <varomodt@google.com> | 2017-09-18 09:38:27 -0700 |
commit | db4251af0823393f084e17c67401b51536ae4cea (patch) | |
tree | baf1909b793751f4be703b768f34d0d629fad513 /src/crypto/asn1/tasn_dec.c | |
parent | 47949c54330cfe56de2f0d0ad9dfdfde9acd3e90 (diff) | |
download | boringssl-db4251af0823393f084e17c67401b51536ae4cea.tar.gz |
external/boringssl: Sync to 9a127b43b8b78a135d6b64a3e25b8a704c2c069f.
This includes the following changes:
https://boringssl.googlesource.com/boringssl/+log/54c259dec395bd991cce5691723214ffe588e51d..9a127b43b8b78a135d6b64a3e25b8a704c2c069f
Test: BoringSSL CTS Presubmits
Change-Id: I8c9fae592051cefd9b284fbebedc5c2240feda30
Diffstat (limited to 'src/crypto/asn1/tasn_dec.c')
-rw-r--r-- | src/crypto/asn1/tasn_dec.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/crypto/asn1/tasn_dec.c b/src/crypto/asn1/tasn_dec.c index bf008af1..2f5f132a 100644 --- a/src/crypto/asn1/tasn_dec.c +++ b/src/crypto/asn1/tasn_dec.c @@ -56,6 +56,7 @@ #include <openssl/asn1.h> +#include <limits.h> #include <string.h> #include <openssl/asn1t.h> @@ -147,15 +148,6 @@ ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, return NULL; } -int ASN1_template_d2i(ASN1_VALUE **pval, - const unsigned char **in, long len, - const ASN1_TEMPLATE *tt) -{ - ASN1_TLC c; - asn1_tlc_clear_nc(&c); - return asn1_template_ex_d2i(pval, in, len, tt, 0, &c); -} - /* * Decode an item, taking care of IMPLICIT tagging, if any. If 'opt' set and * tag mismatch return -1 to handle OPTIONAL @@ -188,6 +180,14 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, else asn1_cb = 0; + /* + * Bound |len| to comfortably fit in an int. Lengths in this module often + * switch between int and long without overflow checks. + */ + if (len > INT_MAX/2) { + len = INT_MAX/2; + } + switch (it->itype) { case ASN1_ITYPE_PRIMITIVE: if (it->templates) { |