[PATCH] D147931: [ARM] Fix null pointer dereferences in ARMMachObjectWriter::recordRelocation()

Alexey Vishnyakov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 14 01:59:53 PDT 2023


SweetVishnya updated this revision to Diff 513490.
SweetVishnya added a comment.

@dmgreen, I fixed the comment. @MaskRay, do you agree with current resolution?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147931

Files:
  llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp


Index: llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
===================================================================
--- llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
+++ llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
@@ -428,8 +428,10 @@
   unsigned Type = 0;
   const MCSymbol *RelSymbol = nullptr;
 
-  if (Target.isAbsolute()) { // constant
-    // FIXME!
+  if (!A) { // constant
+    // FIXME! This is Target.isAbsolute() case as we check SymB above. We check
+    // !A to ensure that null pointer isn't dereferenced and suppress static
+    // analyzer warnings.
     report_fatal_error("FIXME: relocations to absolute targets "
                        "not yet implemented");
   } else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147931.513490.patch
Type: text/x-patch
Size: 733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230414/d01c4437/attachment.bin>


More information about the llvm-commits mailing list