Michael Smith has submitted this change and it was merged. ( https://gerrit.cloudera.org/25349 )
Change subject: IMPALA-15745: Fix out-of-bounds reads found by clang-analyzer-security.ArrayBound ...................................................................... IMPALA-15745: Fix out-of-bounds reads found by clang-analyzer-security.ArrayBound operator<<(ostream&, __int128_t) negated negative values as signed __int128_t, which overflows for the minimum value and left it negative. No parts were then produced and parts[-1] was read. Compute the magnitude as __uint128_t instead, and use a do/while loop so at least one part is always produced. Add LoggingSupport.PrintInt128 to cover boundary values, including the minimum and maximum __int128_t. ShortDayName(), LongDayName(), ShortMonthName() and LongMonthName() indexed name tables with DayOfWeek()/Month() minus one without checking whether those returned NULL (e.g. for a timestamp without a date), which reads index -1. Return NULL (or an empty std::string for the std::string-returning variants) in that case. Previously the std::string variants also returned NULL, which constructs a std::string from a null pointer. Updates another DayOfWeek call that would be covered by clang-analyzer-core.UndefinedBinaryOperatorResult. clang-analyzer-security.ArrayBound remains disabled in .clang-tidy: most of its remaining reports are false positives, including ones inside LLVM, boost, opentelemetry-cpp and rapidjson headers that cannot be suppressed at the reporting location. Change-Id: I3bd608a2098ab1dd161975bb81ba399a84f5d330 Assisted-by: Claude Opus (GitHub Copilot) Reviewed-on: https://gerrit.cloudera.org/25349 Reviewed-by: Michael Smith <[email protected]> Tested-by: Michael Smith <[email protected]> --- M be/src/common/logging.cc M be/src/exprs/timestamp-functions-ir.cc M be/src/util/logging-support-test.cc 3 files changed, 46 insertions(+), 9 deletions(-) Approvals: Michael Smith: Looks good to me, approved; Verified -- To view, visit https://gerrit.cloudera.org/25349 To unsubscribe, visit https://gerrit.cloudera.org/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I3bd608a2098ab1dd161975bb81ba399a84f5d330 Gerrit-Change-Number: 25349 Gerrit-PatchSet: 4 Gerrit-Owner: Michael Smith <[email protected]> Gerrit-Reviewer: Balazs Hevele <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Jason Fehr <[email protected]> Gerrit-Reviewer: Jiyoung Yoo <[email protected]> Gerrit-Reviewer: Joe McDonnell <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]> Gerrit-Reviewer: Yida Wu <[email protected]>
