Fix return value on impossible error condition This codepath is impossible because CBB_add_utf8 will never write more than 4 bytes, much less 6. Change-Id: Ibc97ea1518186bba128a6853d7f039f097a2184e Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/93568 Commit-Queue: Xiangfei Ding <xfding@google.com> Auto-Submit: David Benjamin <davidben@google.com> Reviewed-by: Xiangfei Ding <xfding@google.com> Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/crypto/asn1/a_strex.cc b/crypto/asn1/a_strex.cc index bddcfcb..6aecec5 100644 --- a/crypto/asn1/a_strex.cc +++ b/crypto/asn1/a_strex.cc
@@ -135,7 +135,7 @@ CBB_init_fixed(&utf8_cbb, utf8_buf, sizeof(utf8_buf)); if (!CBB_add_utf8(&utf8_cbb, c)) { OPENSSL_PUT_ERROR(ASN1, ERR_R_INTERNAL_ERROR); - return 1; + return -1; } size_t utf8_len = CBB_len(&utf8_cbb); for (size_t i = 0; i < utf8_len; i++) {