[lldb/DataFormatter] Check for overflow when finding NSDate epoch
authorVedant Kumar <vsk@apple.com>
Tue, 21 Apr 2020 17:00:13 +0000 (10:00 -0700)
committerVedant Kumar <vsk@apple.com>
Mon, 18 May 2020 20:12:00 +0000 (13:12 -0700)
commitb783f70a42575a5d9147bea1ac97e872370fe55b
tree6e487922a57ed22fe074d0b947d5e7e68689e7e9
parent47a0e9f49b903aa4ef821d2c7a679a145ee983f9
[lldb/DataFormatter] Check for overflow when finding NSDate epoch

Summary:
Fixes UBSan-reported issues where the date value inside of an
uninitialized NSDate overflows the 64-bit epoch.

rdar://61774575

Reviewers: JDevlieghere, mib, teemperor

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D80150
lldb/include/lldb/DataFormatters/Mock.h [new file with mode: 0644]
lldb/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/unittests/DataFormatter/CMakeLists.txt
lldb/unittests/DataFormatter/MockTests.cpp [new file with mode: 0644]