Skip to content

Hash function triggers UBSAN

Detected while writing the fuzzer integration:

hash-pjw-bare.c:39:14: runtime error: unsigned integer overflow: 255 + 18446744073709551361 cannot be represented in type 'unsigned long'
    #0 0x5497d3 in hash_pjw_bare /home/oms/src/libtasn1/lib/gl/hash-pjw-bare.c:39:14
    #1 0x53e752 in asn1_find_node /home/oms/src/libtasn1/lib/parser_aux.c
    #2 0x54728a in _asn1_check_identifier /home/oms/src/libtasn1/lib/parser_aux.c:987:9
    #3 0x4fa55a in asn1_array2tree /home/oms/src/libtasn1/lib/structure.c:245:16
    #4 0x4f84d6 in LLVMFuzzerTestOneInput /home/oms/src/libtasn1/fuzz/libtasn1_array2tree_fuzzer.c:79:3

This is expected behavior of hash functions. But it needs to be suppressed to not disguise other findings.