Skip to content

Fix UB reported by clang-22 #1947

@npajkovsky

Description

@npajkovsky
$ CC=clang-22 ./Configure --banner=Configured --debug enable-asan enable-ubsan -fno-omit-frame-pointer -fno-common --strict-warnings
$ make -s -j12 test HARNESS_JOBS=6 2>&1 | rg 'runtime error: call to function' > ubsan.log
$ cat ubsan.log | sort | uniq -c
     14 crypto/asn1/a_d2i_fp.c:50:11: runtime error: call to function d2i_OCSP_RESPONSE through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
      2 crypto/asn1/a_d2i_fp.c:50:11: runtime error: call to function d2i_TS_RESP through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
      1 crypto/asn1/a_i2d_fp.c:40:9: runtime error: call to function i2d_ECPKParameters through pointer to incorrect function type 'int (*)(const void *, unsigned char **)'
      1 crypto/asn1/a_i2d_fp.c:40:9: runtime error: call to function i2d_KeyParams through pointer to incorrect function type 'int (*)(const void *, unsigned char **)'
    196 crypto/asn1/a_i2d_fp.c:40:9: runtime error: call to function i2d_PKCS8_PRIV_KEY_INFO through pointer to incorrect function type 'int (*)(const void *, unsigned char **)'
      7 crypto/asn1/tasn_enc.c:169:25: runtime error: call to function cms_cb through pointer to incorrect function type 'int (*)(int, const struct ASN1_VALUE_st **, const struct ASN1_ITEM_st *, void *)'
      6 crypto/asn1/tasn_enc.c:169:25: runtime error: call to function crl_cb through pointer to incorrect function type 'int (*)(int, const struct ASN1_VALUE_st **, const struct ASN1_ITEM_st *, void *)'
     12 crypto/asn1/tasn_enc.c:169:25: runtime error: call to function dh_cb through pointer to incorrect function type 'int (*)(int, const struct ASN1_VALUE_st **, const struct ASN1_ITEM_st *, void *)'
     12 crypto/asn1/tasn_enc.c:169:25: runtime error: call to function dsa_cb through pointer to incorrect function type 'int (*)(int, const struct ASN1_VALUE_st **, const struct ASN1_ITEM_st *, void *)'
      3 crypto/asn1/tasn_enc.c:169:25: runtime error: call to function pkey_cb through pointer to incorrect function type 'int (*)(int, const struct ASN1_VALUE_st **, const struct ASN1_ITEM_st *, void *)'
      3 crypto/asn1/tasn_enc.c:169:25: runtime error: call to function rsa_cb through pointer to incorrect function type 'int (*)(int, const struct ASN1_VALUE_st **, const struct ASN1_ITEM_st *, void *)'
      1 crypto/asn1/tasn_enc.c:169:25: runtime error: call to function x509_cb through pointer to incorrect function type 'int (*)(int, const struct ASN1_VALUE_st **, const struct ASN1_ITEM_st *, void *)'
      1 crypto/bio/bss_core.c:66:12: runtime error: call to function tst_bio_core_ctrl through pointer to incorrect function type 'int (*)(struct ossl_core_bio_st *, int, long, void *)'
      1 crypto/bsearch.c:33:17: runtime error: call to function int_compare through pointer to incorrect function type 'int (*)(const void *, const void *)'
      1 crypto/bsearch.c:33:17: runtime error: call to function ssl_cipher_ptr_id_cmp through pointer to incorrect function type 'int (*)(const void *, const void *)'
     12 crypto/encode_decode/encoder_lib.c:343:23: runtime error: call to function key2ms_newctx through pointer to incorrect function type 'void *(*)(void *)'
      1 crypto/evp/digest.c:283:12: runtime error: call to function MD4_Update through pointer to incorrect function type 'int (*)(void *, const unsigned char *, unsigned long)'
     13 crypto/evp/digest.c:283:12: runtime error: call to function MD5_Update through pointer to incorrect function type 'int (*)(void *, const unsigned char *, unsigned long)'
      1 crypto/evp/digest.c:283:12: runtime error: call to function MDC2_Update through pointer to incorrect function type 'int (*)(void *, const unsigned char *, unsigned long)'
      1 crypto/evp/digest.c:283:12: runtime error: call to function ossl_blake2b_update through pointer to incorrect function type 'int (*)(void *, const unsigned char *, unsigned long)'
      2 crypto/evp/digest.c:283:12: runtime error: call to function ossl_blake2s_update through pointer to incorrect function type 'int (*)(void *, const unsigned char *, unsigned long)'
      1 crypto/evp/digest.c:283:12: runtime error: call to function ossl_md5_sha1_update through pointer to incorrect function type 'int (*)(void *, const unsigned char *, unsigned long)'
      4 crypto/evp/digest.c:283:12: runtime error: call to function ossl_sm3_update through pointer to incorrect function type 'int (*)(void *, const unsigned char *, unsigned long)'
      1 crypto/evp/digest.c:283:12: runtime error: call to function ossltest_dgst_update through pointer to incorrect function type 'int (*)(void *, const unsigned char *, unsigned long)'
      1 crypto/evp/digest.c:283:12: runtime error: call to function RIPEMD160_Update through pointer to incorrect function type 'int (*)(void *, const unsigned char *, unsigned long)'
      1 crypto/evp/digest.c:283:12: runtime error: call to function WHIRLPOOL_Update through pointer to incorrect function type 'int (*)(void *, const unsigned char *, unsigned long)'
      1 crypto/evp/evp_fetch.c:627:9: runtime error: call to function collect_cipher_cb through pointer to incorrect function type 'void (*)(void *, void *)'
      2 crypto/evp/evp_fetch.c:627:9: runtime error: call to function collect_cipher_names through pointer to incorrect function type 'void (*)(void *, void *)'
     16 crypto/evp/evp_fetch.c:627:9: runtime error: call to function collect_kem through pointer to incorrect function type 'void (*)(void *, void *)'
   1411 crypto/evp/evp_fetch.c:627:9: runtime error: call to function collect_keymgmt through pointer to incorrect function type 'void (*)(void *, void *)'
      1 crypto/evp/evp_fetch.c:627:9: runtime error: call to function collect_macs through pointer to incorrect function type 'void (*)(void *, void *)'
      4 crypto/evp/keymgmt_meth.c:392:5: runtime error: call to function ossl_ecx_key_free through pointer to incorrect function type 'void (*)(void *)'
     13 crypto/evp/keymgmt_meth.c:392:5: runtime error: call to function ossl_ml_kem_key_free through pointer to incorrect function type 'void (*)(void *)'
      1 crypto/modes/cbc128.c:49:13: runtime error: call to function AES_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
     12 crypto/modes/cbc128.c:49:13: runtime error: call to function ossl_aria_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      5 crypto/modes/cbc128.c:49:13: runtime error: call to function ossl_sm4_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      1 crypto/modes/cbc128.c:49:13: runtime error: call to function SEED_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      6 crypto/modes/cfb128.c:162:5: runtime error: call to function Camellia_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
     18 crypto/modes/cfb128.c:162:5: runtime error: call to function ossl_aria_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      3 crypto/modes/cfb128.c:54:21: runtime error: call to function Camellia_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      9 crypto/modes/cfb128.c:54:21: runtime error: call to function ossl_aria_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      3 crypto/modes/cfb128.c:54:21: runtime error: call to function ossl_sm4_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      3 crypto/modes/ctr128.c:100:17: runtime error: call to function Camellia_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      9 crypto/modes/ctr128.c:100:17: runtime error: call to function ossl_aria_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      3 crypto/modes/ctr128.c:100:17: runtime error: call to function ossl_sm4_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      3 crypto/modes/ofb128.c:52:17: runtime error: call to function Camellia_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      9 crypto/modes/ofb128.c:52:17: runtime error: call to function ossl_aria_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      3 crypto/modes/ofb128.c:52:17: runtime error: call to function ossl_sm4_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      5 crypto/modes/wrap128.c:76:13: runtime error: call to function AES_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      1 crypto/pem/pem_info.c:169:28: runtime error: call to function d2i_AutoPrivateKey through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
      1 crypto/pem/pem_info.c:169:28: runtime error: call to function d2i_X509_CRL through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
     20 crypto/pem/pem_info.c:169:28: runtime error: call to function d2i_X509 through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
    404 crypto/pem/pem_lib.c:352:27: runtime error: call to function i2d_PKCS8_PRIV_KEY_INFO through pointer to incorrect function type 'int (*)(const void *, unsigned char **)'
      1 crypto/pem/pem_lib.c:352:27: runtime error: call to function i2d_X509_PUBKEY through pointer to incorrect function type 'int (*)(const void *, unsigned char **)'
      1 crypto/pem/pem_oth.c:31:11: runtime error: call to function d2i_DSAparams through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
      6 crypto/pem/pem_oth.c:31:11: runtime error: call to function d2i_PKCS7 through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
      2 crypto/pem/pem_oth.c:31:11: runtime error: call to function d2i_SSL_SESSION through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
      1 crypto/pem/pem_oth.c:31:11: runtime error: call to function d2i_X509_ACERT through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
     62 crypto/pem/pem_oth.c:31:11: runtime error: call to function d2i_X509_AUX through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
      5 crypto/pem/pem_oth.c:31:11: runtime error: call to function d2i_X509_PUBKEY through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
      3 crypto/pem/pem_oth.c:31:11: runtime error: call to function d2i_X509_REQ through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
     32 crypto/pem/pem_oth.c:31:11: runtime error: call to function d2i_X509 through pointer to incorrect function type 'void *(*)(void **, const unsigned char **, long)'
      3 crypto/property/property.c:227:12: runtime error: call to function EVP_SKEYMGMT_up_ref through pointer to incorrect function type 'int (*)(void *)'
     59 crypto/provider_core.c:1756:9: runtime error: call to function OSSL_LIB_CTX_free through pointer to incorrect function type 'void (*)(void *)'
      1 crypto/provider_core.c:1778:15: runtime error: call to function null_gettable_params through pointer to incorrect function type 'const struct ossl_param_st *(*)(void *)'
      5 crypto/provider_core.c:1967:11: runtime error: call to function null_query through pointer to incorrect function type 'const struct ossl_algorithm_st *(*)(void *, int, int *)'
      3 crypto/provider_core.c:1967:11: runtime error: call to function p_query through pointer to incorrect function type 'const struct ossl_algorithm_st *(*)(void *, int, int *)'
      1 crypto/stack/stack.c:468:17: runtime error: call to function st_free through pointer to incorrect function type 'void (*)(void *)'
     10 crypto/stack/stack.c:81:33: runtime error: call to function infopair_copy through pointer to incorrect function type 'void *(*)(const void *)'
      1 crypto/x509/v3_conf.c:108:21: runtime error: call to function sxnet_v2i through pointer to incorrect function type 'void *(*)(const struct v3_ext_method *, struct v3_ext_ctx *, struct stack_st_CONF_VALUE *)'
      7 crypto/x509/v3_conf.c:108:21: runtime error: call to function v2i_ASN1_BIT_STRING through pointer to incorrect function type 'void *(*)(const struct v3_ext_method *, struct v3_ext_ctx *, struct stack_st_CONF_VALUE *)'
      1 crypto/x509/v3_conf.c:108:21: runtime error: call to function v2i_AUTHORITY_KEYID through pointer to incorrect function type 'void *(*)(const struct v3_ext_method *, struct v3_ext_ctx *, struct stack_st_CONF_VALUE *)'
      3 crypto/x509/v3_conf.c:108:21: runtime error: call to function v2i_subject_alt through pointer to incorrect function type 'void *(*)(const struct v3_ext_method *, struct v3_ext_ctx *, struct stack_st_CONF_VALUE *)'
     34 crypto/x509/v3_conf.c:114:26: runtime error: call to function s2i_skey_id through pointer to incorrect function type 'void *(*)(const struct v3_ext_method *, struct v3_ext_ctx *, const char *)'
      1 include/openssl/asn1t.h:886:1: runtime error: call to function PKCS12_SAFEBAG_free through pointer to incorrect function type 'void (*)(struct ASN1_VALUE_st *)'
      1 include/openssl/asn1t.h:886:1: runtime error: call to function PKCS7_free through pointer to incorrect function type 'void (*)(struct ASN1_VALUE_st *)'
     15 providers/common/bio_prov.c:124:12: runtime error: call to function ossl_core_bio_ctrl through pointer to incorrect function type 'int (*)(struct ossl_core_bio_st *, int, long, void *)'
     13 providers/implementations/ciphers/ciphercommon_hw.c:20:9: runtime error: call to function Camellia_cbc_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, unsigned long, const void *, unsigned char *, int)'
     10 providers/implementations/ciphers/ciphercommon_hw.c:41:13: runtime error: call to function Camellia_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
     14 providers/implementations/ciphers/ciphercommon_hw.c:41:13: runtime error: call to function ossl_aria_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      4 providers/implementations/ciphers/ciphercommon_hw.c:41:13: runtime error: call to function ossl_sm4_encrypt through pointer to incorrect function type 'void (*)(const unsigned char *, unsigned char *, const void *)'
      1 ssl/priority_queue.c:159:13: runtime error: call to function net_pkt_cmp through pointer to incorrect function type 'int (*)(const void *, const void *)'
      1 ssl/priority_queue.c:159:13: runtime error: call to function rcid_cmp through pointer to incorrect function type 'int (*)(const void *, const void *)'
      1 ssl/priority_queue.c:159:13: runtime error: call to function size_t_compare through pointer to incorrect function type 'int (*)(const void *, const void *)'
      1 test/asn1_encode_test.c:534:11: runtime error: call to function i2d_ASN1_LONG_DATA through pointer to incorrect function type 'int (*)(void *, unsigned char **)'
      5 test/evp_test.c:237:10: runtime error: call to function EVP_PKEY_get_params through pointer to incorrect function type 'int (*)(void *, struct ossl_param_st *)'
      1 test/json_test.c:587:13: runtime error: call to function ossl_json_bool through pointer to incorrect function type 'void (*)(struct ossl_json_enc_st *, int)'

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Epic.

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions