  
  extern "C" {
  // This function should be defined by the user.
-@@ -17,5 +18,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);
- }  // extern "C"
- 
- ATTRIBUTE_INTERFACE int main(int argc, char **argv) {
-+  fuzzer::TPC.InitializeMainObjectInformation();
-   return fuzzer::FuzzerDriver(&argc, &argv, LLVMFuzzerTestOneInput);
- }
 diff --git a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
-index f12f7aa61bc4..be01bc0c6510 100644
+index f12f7aa61bc4..c45178254383 100644
 --- a/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
 +++ b/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp
 @@ -27,6 +27,14 @@

 ATTRIBUTE_INTERFACE ATTRIBUTE_NO_SANITIZE_MEMORY
 void __sanitizer_weak_hook_memcmp(void *caller_pc, const void *s1,
                                   const void *s2, size_t n, int result) {
@@ -682,4 +757,37 @@ void __sanitizer_weak_hook_memmem(void *called_pc, const void *s1, size_t len1,
   if (!fuzzer::RunningUserCallback) return;
   fuzzer::TPC.MMT.Add(reinterpret_cast<const uint8_t *>(s2), len2);
 }

+
+  uintptr_t PCOffset = PC - main_object_start_address;
+  uintptr_t LoadOffset = LoadAddr - main_object_start_address;
+
+  if (PCOffset >= main_object_size) return;
+  if (LoadOffset >= main_object_size) return;
