"Invalid encoding" occurs when reading STRTAB_BLOCK of bitcode generated by LTO


Can STRTAB_BLOCK include more than one STRTAB_BLOB records?

https://llvm.org/docs/BitCodeFormat.html#strtab-block-contents says

“”“The STRTAB block (id 23) contains a single record (STRTAB_BLOB, id 1) with a single blob operand containing the bitcode file’s string table. …”""

The code readBlobInRecord also assumes this because if there are multiple blob records, only the last one returns.

I found an “Invalid encoding” from hasEncodingData when reading the bitcode generated by LTO. This happens when reading a STRTAB_BLOCK. The STRTAB_BLOCK contains the following:

STRTAB block

abbrev definition, 1, blob // abbrev_id = 4

STRTAB_BLOB, 549524261, data

STRTAB_BLOB, 29258, data

abbrev definition, 14, … // crashes when reading the 9th operand where the encoding data are not between 1 to 5.

Does this mean the bitcode generated by LTO was corrupt? Does anyone happen to have a similar issue before?

Thank you, S