From: Joshua Rogers Date: Sat, 11 Oct 2025 12:40:13 +0000 (+0800) Subject: asn1: clear error mark on success in asn1_d2i_read_bio X-Git-Tag: 3.6-PRE-CLANG-FORMAT-WEBKIT~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ad8a53a6a73731be994f4b0cf1ce8f500a848fc;p=thirdparty%2Fopenssl.git asn1: clear error mark on success in asn1_d2i_read_bio Balance ERR_set_mark by calling ERR_clear_last_mark on the success path. Prevents a stale mark from skewing later error handling. Signed-off-by: Joshua Rogers Reviewed-by: Matt Caswell Reviewed-by: Eugene Syromiatnikov Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/28882) (cherry picked from commit 7f015c909ee3480a59d4fe828c3da22c7a55a2f4) --- diff --git a/crypto/asn1/a_d2i_fp.c b/crypto/asn1/a_d2i_fp.c index 0c88c981068..10fe54afdab 100644 --- a/crypto/asn1/a_d2i_fp.c +++ b/crypto/asn1/a_d2i_fp.c @@ -169,6 +169,7 @@ int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) if (e != ASN1_R_TOO_LONG) goto err; ERR_pop_to_mark(); + ERR_set_mark(); } off += q - p; /* end of data */ @@ -249,6 +250,7 @@ int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) } *pb = b; + ERR_clear_last_mark(); return (int)off; err: ERR_clear_last_mark();