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 00000000..6f062a74 Binary files /dev/null and b/snapshot/ios/testdata/crash-1fa088dda0adb41459d063078a0f384a0bb8eefa differ