Loading
electron: fix LLVM 21+ build by backporting patch
chromium <139's histogram_macros_internal.h contains a UB static cast
that causes a compile error for LLVM 21+
return static_cast<Enum>(base::to_underlying(Enum::kMaxValue) + 1);
→
integer value 4 is outside the valid range of values [0, 3] for the enumeration type 'LandlockState'
→
error: static assertion expression is not an integral constant expression
UMA_HISTOGRAM_ENUMERATION("Security.Sandbox.LandlockState", landlock_state);
applying upstream fix from https://chromium-review.googlesource.com/c/chromium/src/+/6633292
A static cast to an enum type that is outside the range of enum values
was defined to be undefined behavior in February 2014 in
https://cplusplus.github.io/CWG/issues/1766.html