Don't assume the type we read was the type we expected
authorMatt Caswell <matt@openssl.org>
Wed, 30 Oct 2019 13:23:18 +0000 (13:23 +0000)
committerMatt Caswell <matt@openssl.org>
Mon, 4 Nov 2019 12:49:19 +0000 (12:49 +0000)
commitaec9667bd19a8ca9bdd519db3a231a95b9e92674
treea8aad958d436f5ab95151169f6c03c919d03a65d
parent45b244620a74248b46ebe1c85e86437b9641447a
Don't assume the type we read was the type we expected

i2v_GENERAL_NAME and GENERAL_NAME_print were assuming that the type of
of a GENERAL_NAME (OTHERNAME) that we read in was the type we expected
it to be. If its something else then this can cause unexpected
behaviour. In the added fuzz test case an OOB read was occurring.

This issue was recently added by commit 4baee2d.

Credit to OSSFuzz for finding this issue.

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10300)
crypto/x509/v3_alt.c
fuzz/corpora/x509/9901a721c7fe85b8208198cc5e77ac719f592577 [new file with mode: 0644]