From 66ec5c90667a32030d64af6d3da426924fbc732a Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Wed, 30 Mar 2016 14:26:46 -0400 Subject: [PATCH] Also re-serialize X509 objects in fuzz/cert.cc. This is a fairly common operation on an X509. Change-Id: I1820f20b555f75c98ab7e3283b5530bc1c200e2a Reviewed-on: https://boringssl-review.googlesource.com/7611 Reviewed-by: Steven Valdez Reviewed-by: David Benjamin --- fuzz/cert.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fuzz/cert.cc b/fuzz/cert.cc index 4078c0ec2..e813ed566 100644 --- a/fuzz/cert.cc +++ b/fuzz/cert.cc @@ -1,11 +1,17 @@ +#include #include extern "C" int LLVMFuzzerTestOneInput(uint8_t *buf, size_t len) { const uint8_t *bufp = buf; X509 *x509 = d2i_X509(NULL, &bufp, len); if (x509 != NULL) { - /* Also extract the public key. */ + /* Extract the public key. */ EVP_PKEY_free(X509_get_pubkey(x509)); + + /* Reserialize the structure. */ + uint8_t *der = NULL; + i2d_X509(x509, &der); + OPENSSL_free(der); } X509_free(x509); return 0;