[llvm] [BOLT] Add guardrails around reading malformed input (PR #192348)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 14:48:26 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- bolt/lib/Rewrite/RewriteInstance.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index d54ce2229..d0fbfd100 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -3033,8 +3033,8 @@ void RewriteInstance::handleRelocation(const SectionRef &RelocatedSection,
     Expected<section_iterator> SectionOrErr = Symbol.getSection();
     if (!SectionOrErr) {
       BC->errs() << "BOLT-WARNING: unable to get section for relocation symbol"
-                 << " at offset 0x"
-                 << Twine::utohexstr(Rel.getOffset()) << '\n';
+                 << " at offset 0x" << Twine::utohexstr(Rel.getOffset())
+                 << '\n';
       consumeError(SectionOrErr.takeError());
     } else if (*SectionOrErr != InputFile->section_end()) {
       Expected<StringRef> SectionName = (*SectionOrErr)->getName();

``````````

</details>


https://github.com/llvm/llvm-project/pull/192348


More information about the llvm-commits mailing list