refactor: Use static_cast<decltype(...)> to suppress integer sanitizer warning
What changed, and why it matters
This is a code cleanup that silences a harmless automated sanitizer warning. It does not change how the program behaves, fix a bug, or close a security hole. The change removes a suppression entry for a warning that is no longer triggered.
No security action needed. Treat as normal refactoring/CI hygiene.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors SetStdinEcho in src/compat/stdin.cpp to use static_cast
Changed components
src/compat/stdin.cpptest/sanitizer_suppressions/ubsanInspect captured patch +1 / −2
diff --git a/src/compat/stdin.cpp b/src/compat/stdin.cpp
index 0579f64a..10c811ad 100644
--- a/src/compat/stdin.cpp
+++ b/src/compat/stdin.cpp
@@ -43,7 +43,7 @@ void SetStdinEcho(bool enable)
return;
}
if (!enable) {
- tty.c_lflag &= ~ECHO;
+ tty.c_lflag &= static_cast<decltype(tty.c_lflag)>(~ECHO);
} else {
tty.c_lflag |= ECHO;
}
diff --git a/test/sanitizer_suppressions/ubsan b/test/sanitizer_suppressions/ubsan
index 0151f9d0..ad604e63 100644
--- a/test/sanitizer_suppressions/ubsan
+++ b/test/sanitizer_suppressions/ubsan
@@ -55,7 +55,6 @@ unsigned-integer-overflow:TxConfirmStats::EstimateMedianVal
unsigned-integer-overflow:InsecureRandomContext::rand64
unsigned-integer-overflow:InsecureRandomContext::SplitMix64
unsigned-integer-overflow:bitset_detail::PopCount
-implicit-integer-sign-change:SetStdinEcho
implicit-integer-sign-change:compressor.h
implicit-integer-sign-change:crypto/
implicit-integer-sign-change:TxConfirmStats::removeTx
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.