[llvm-dev] "Invalid encoding" occurs when reading STRTAB_BLOCK of bitcode generated by LTO

Stephan Z via llvm-dev llvm-dev at lists.llvm.org
Fri Aug 14 22:43:56 PDT 2020


Hi,

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
<https://llvm.org/doxygen/BitcodeReader_8cpp_source.html#l06407> also
assumes this because if there are multiple blob records, only the last one
returns.


I found an "Invalid encoding" from hasEncodingData
<https://llvm.org/doxygen/BitCodes_8h_source.html#l00126> 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
<https://llvm.org/doxygen/BitCodes_8h_source.html#l00100>.*


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


Thank you, S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200814/175e0060/attachment-0001.html>


More information about the llvm-dev mailing list