Open williamcroberts opened 1 year ago
@AndreasFuchsTPM this is a bug in the spec causing ubsan to trigger
@JuergenReppSIT can you bring this up to @AndreasFuchsTPM , this is a bug that will require a spec change
So I guess the bug is here: https://github.com/tpm2-software/tpm2-tss/blob/702a8715f761e0e6127fd608b58bfe15fb2fa8dd/include/tss2/tss2_tpm2_types.h#L660-L666 https://github.com/tpm2-software/tpm2-tss/blob/702a8715f761e0e6127fd608b58bfe15fb2fa8dd/include/tss2/tss2_tpm2_types.h#L686-L686
We have to upcast to TPM2_HR before the shift since the TPM2HT* defines are all uint8_t.
Yeah exactly
UBSAN reports this:
On code like this:
I was able to reproduce this with a trivial C program:
Compiled like so:
However, this works:
We'll need to promote that type when used in the left shifts.