File openssl-CVE-2016-2108.patch of Package openssl.2462
From c5e4bc81c5a142cab7f46f69824fa35367999ee8 Mon Sep 17 00:00:00 2001
From: Dr. Stephen Henson <steve@openssl.org>
Date: Fri, 15 Apr 2016 02:37:09 +0100
Subject: [PATCH] Fix ASN1_INTEGER handling.
Only treat an ASN1_ANY type as an integer if it has the V_ASN1_INTEGER
tag: V_ASN1_NEG_INTEGER is an internal only value which is never used
for on the wire encoding.
Thanks to David Benjamin <davidben@google.com> for reporting this bug.
This was found using libFuzzer.
RT#4364 (part)CVE-2016-2108.
---
crypto/asn1/a_type.c | 2 --
crypto/asn1/tasn_dec.c | 2 --
crypto/asn1/tasn_enc.c | 2 --
3 files changed, 0 insertions(+), 6 deletions(-)
Index: openssl-1.0.1i/crypto/asn1/a_type.c
===================================================================
--- openssl-1.0.1i.orig/crypto/asn1/a_type.c 2016-04-28 15:39:48.512663139 +0200
+++ openssl-1.0.1i/crypto/asn1/a_type.c 2016-04-28 15:42:49.378664932 +0200
@@ -131,9 +131,7 @@ int ASN1_TYPE_cmp(const ASN1_TYPE *a, co
result = 0; /* They do not have content. */
break;
case V_ASN1_INTEGER:
- case V_ASN1_NEG_INTEGER:
case V_ASN1_ENUMERATED:
- case V_ASN1_NEG_ENUMERATED:
case V_ASN1_BIT_STRING:
case V_ASN1_OCTET_STRING:
case V_ASN1_SEQUENCE:
Index: openssl-1.0.1i/crypto/asn1/tasn_dec.c
===================================================================
--- openssl-1.0.1i.orig/crypto/asn1/tasn_dec.c 2016-04-28 15:39:48.512663139 +0200
+++ openssl-1.0.1i/crypto/asn1/tasn_dec.c 2016-04-28 15:44:38.059490691 +0200
@@ -1006,9 +1006,7 @@ int asn1_ex_c2i(ASN1_VALUE **pval, const
break;
case V_ASN1_INTEGER:
- case V_ASN1_NEG_INTEGER:
case V_ASN1_ENUMERATED:
- case V_ASN1_NEG_ENUMERATED:
tint = (ASN1_INTEGER **)pval;
if (!c2i_ASN1_INTEGER(tint, &cont, len))
goto err;
Index: openssl-1.0.1i/crypto/asn1/tasn_enc.c
===================================================================
--- openssl-1.0.1i.orig/crypto/asn1/tasn_enc.c 2016-04-28 15:39:48.512663139 +0200
+++ openssl-1.0.1i/crypto/asn1/tasn_enc.c 2016-04-28 15:45:41.659558469 +0200
@@ -643,9 +643,7 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsig
break;
case V_ASN1_INTEGER:
- case V_ASN1_NEG_INTEGER:
case V_ASN1_ENUMERATED:
- case V_ASN1_NEG_ENUMERATED:
/* These are all have the same content format
* as ASN1_INTEGER
*/