[Lldb-commits] [PATCH] D80150: [lldb/DataFormatter] Check for overflow when finding NSDate epoch

Vedant Kumar via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri May 22 18:14:32 PDT 2020


vsk updated this revision to Diff 265829.
vsk added a comment.

Apologies for all the breakage. I think I've identified the issues in the
initial patch which caused breakage on the bots, and which caused the tests to
not target what they meant to test.

I've reworked this patch to use std::llrint, instead of casting the max
`time_t` value to `double` as part of an overflow check. The cast to `double`
was not precise, and could crash on some machines (presumably due to a floating
point exception?).

For the tests, I've added asserts to make sure that the specially-crafted
values that are meant to trigger clamping behavior in std::llrint, or an
overflow in `llvm::checkedAdd`, actually do satisfy those conditions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80150/new/

https://reviews.llvm.org/D80150

Files:
  lldb/include/lldb/DataFormatters/FormattersHelpers.h
  lldb/source/Plugins/Language/ObjC/CF.cpp
  lldb/source/Plugins/Language/ObjC/Cocoa.cpp
  lldb/source/Plugins/Language/ObjC/Utilities.h
  lldb/unittests/Language/AppleObjC/CMakeLists.txt
  lldb/unittests/Language/AppleObjC/UtilitiesTests.cpp
  lldb/unittests/Language/CMakeLists.txt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80150.265829.patch
Type: text/x-patch
Size: 11479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200523/eb7ec915/attachment.bin>


More information about the lldb-commits mailing list