From 693128a2cda0359dd4c2882b6dd59ef614db9392 Mon Sep 17 00:00:00 2001 From: Mikhail Efremov Date: Thu, 2 Jun 2022 18:33:09 +0300 Subject: [PATCH] Fix build with gcc12 Use assert() to ensure that NULL is not dereferenced. --- src/asn1Coding.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/asn1Coding.c b/src/asn1Coding.c index f1869bf..d3951b3 100644 --- a/src/asn1Coding.c +++ b/src/asn1Coding.c @@ -311,6 +311,8 @@ main (int argc, char *argv[]) der_len = 0; asn1_result = asn1_der_coding (structure, "", NULL, &der_len, errorDescription); + /* The result must never be success: there is no memory, it just fill the der_len variable */ + assert (asn1_result != ASN1_SUCCESS); if (asn1_result == ASN1_MEM_ERROR) { der = malloc (der_len); -- 2.33.3