lifting-bits / cxx-common

Common dependency management for various Trail of Bits C++ codebases
Apache License 2.0
31 stars 11 forks source link

Add llvm-16 patch to not crash on invalid sourcelocs #1023

Closed 2over12 closed 1 year ago

2over12 commented 1 year ago

Clang 16 added a semantic check for flexible array members that relies on grabbing sourceloc info for array types that are the last member of a union. If the sourceloc info is empty dyn_cast<IntegerLiteral>(CTL.getSizeExpr()) will crash because getSizeExpr will be null and dyn_cast asserts a nonnulll input. Another plausible fix would be to do dyn_cast_or_null here but that would result in false. Still determining the best patch/testing

2over12 commented 1 year ago

Any preferences on how we do clang patches like this? ie. gated behind a flag?