From 4bf79bc2bfb1ae3098f792fb9f7ccb0d5a4e726c Mon Sep 17 00:00:00 2001 From: Justin Cohen Date: Fri, 5 Nov 2021 15:23:47 -0400 Subject: [PATCH] ios: Fix typo in checking thread_times values. Change-Id: I4199b5b149d7792dcfb8a3b8de571026b1e98521 Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/3264806 Reviewed-by: Mark Mentovai Commit-Queue: Justin Cohen --- snapshot/BUILD.gn | 13 ++++++++++++- .../ios/process_snapshot_ios_intermediate_dump.cc | 4 ++-- ...process_snapshot_ios_intermediate_dump_test.cc | 10 ++++++++++ ...crash-1fa088dda0adb41459d063078a0f384a0bb8eefa | Bin 0 -> 565 bytes 4 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 snapshot/ios/testdata/crash-1fa088dda0adb41459d063078a0f384a0bb8eefa diff --git a/snapshot/BUILD.gn b/snapshot/BUILD.gn index b0158194..fc2246a5 100644 --- a/snapshot/BUILD.gn +++ b/snapshot/BUILD.gn @@ -444,7 +444,10 @@ source_set("snapshot_test") { } if (crashpad_is_ios) { - deps += [ "../minidump" ] + deps += [ + ":snapshot_test_ios_data", + "../minidump", + ] } data_deps = [ @@ -485,6 +488,14 @@ source_set("snapshot_test") { } } +bundle_data("snapshot_test_ios_data") { + testonly = true + + sources = [ "ios/testdata/crash-1fa088dda0adb41459d063078a0f384a0bb8eefa" ] + + outputs = [ "{{bundle_resources_dir}}/crashpad_test_data/" + + "{{source_root_relative_dir}}/{{source_file_part}}" ] +} crashpad_loadable_module("crashpad_snapshot_test_module") { testonly = true sources = [ "crashpad_info_client_options_test_module.cc" ] diff --git a/snapshot/ios/process_snapshot_ios_intermediate_dump.cc b/snapshot/ios/process_snapshot_ios_intermediate_dump.cc index 7f022002..619ea958 100644 --- a/snapshot/ios/process_snapshot_ios_intermediate_dump.cc +++ b/snapshot/ios/process_snapshot_ios_intermediate_dump.cc @@ -77,9 +77,9 @@ bool ProcessSnapshotIOSIntermediateDump::Initialize( const IOSIntermediateDumpMap* thread_times = process_info->GetAsMap(Key::kTaskThreadTimes); if (thread_times) { - GetDataValueFromMap(basic_info, Key::kUserTime, &thread_times_user_time_); + GetDataValueFromMap(thread_times, Key::kUserTime, &thread_times_user_time_); GetDataValueFromMap( - basic_info, Key::kSystemTime, &thread_times_system_time_); + thread_times, Key::kSystemTime, &thread_times_system_time_); } GetDataValueFromMap(process_info, Key::kSnapshotTime, &snapshot_time_); diff --git a/snapshot/ios/process_snapshot_ios_intermediate_dump_test.cc b/snapshot/ios/process_snapshot_ios_intermediate_dump_test.cc index 1796c76c..dc3ad272 100644 --- a/snapshot/ios/process_snapshot_ios_intermediate_dump_test.cc +++ b/snapshot/ios/process_snapshot_ios_intermediate_dump_test.cc @@ -25,6 +25,7 @@ #include "minidump/minidump_file_writer.h" #include "test/errors.h" #include "test/scoped_temp_dir.h" +#include "test/test_paths.h" #include "util/file/file_io.h" #include "util/file/filesystem.h" #include "util/file/string_file.h" @@ -630,6 +631,15 @@ TEST_F(ProcessSnapshotIOSIntermediateDumpTest, FullReport) { ExpectSnapshot(process_snapshot); } +TEST_F(ProcessSnapshotIOSIntermediateDumpTest, FuzzTestCases) { + base::FilePath fuzz_path = TestPaths::TestDataRoot().Append(FILE_PATH_LITERAL( + "snapshot/ios/testdata/crash-1fa088dda0adb41459d063078a0f384a0bb8eefa")); + + crashpad::internal::ProcessSnapshotIOSIntermediateDump process_snapshot; + EXPECT_TRUE(process_snapshot.Initialize(fuzz_path, {})); + EXPECT_TRUE(LoggingRemoveFile(path())); +} + } // namespace } // namespace test } // namespace crashpad diff --git a/snapshot/ios/testdata/crash-1fa088dda0adb41459d063078a0f384a0bb8eefa b/snapshot/ios/testdata/crash-1fa088dda0adb41459d063078a0f384a0bb8eefa new file mode 100644 index 0000000000000000000000000000000000000000..6f062a744bc5e3733ee0f98c7df193169a052eab GIT binary patch literal 565 zcmZQ$Wn^GvfB;6u1^lc__ywTcO%APzP$r0CVqC`0x`LkrN$7qQ8w2Zd6roLtObkp+ zj2*(P{lZdErJ4T03c;DVr8$Wu`9%sEnE@I3d8vj*I>wr;lZ08Iiui#v>tr|=B+5Dg zl{-bvE3jFGZpZtTW+Uy@kxc&}A+VXJjpxhlLzSA8Uy?3b#TW=0d|vGqCr2z&>X! t7GDANmOKL_;$hx=F;#cx_j(2f4T!u>+kYTu0aWn7ElCBSZ|WJqssS8Ga0LJW literal 0 HcmV?d00001