[all-commits] [llvm/llvm-project] 15cbda: [clang][Serialization] Fix latent bug in adjustFil...

Michael Spencer via All-commits all-commits at lists.llvm.org
Thu Oct 1 14:25:49 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 15cbda42e14b7aea32533183520df4f9eba1444c
      https://github.com/llvm/llvm-project/commit/15cbda42e14b7aea32533183520df4f9eba1444c
  Author: Michael Spencer <bigcheesegs at gmail.com>
  Date:   2026-10-01 (Thu, 01 Oct 2026)

  Changed paths:
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/unittests/Serialization/CMakeLists.txt
    A clang/unittests/Serialization/ResolveImportedPathTest.cpp

  Log Message:
  -----------
  [clang][Serialization] Fix latent bug in adjustFilenameForRelocatableAST (#227910)

This patch fixes a latent bug in `adjustFilenameForRelocatableAST`. It
relies on a null terminator, but `PreparePathForOutput` passes in a
`StringRef::data()` that has no null-terminator. Today this is benign as
nothing passes in a path that would hit the attempt at checking for a
null terminator, but future patches will.

The fix both makes the code safer by removing the C string usage, and
handles passing in the base path itself by representing it as `.` and
resolving that back to the (possibly relocated) base path on read.

No test on the writer part as it's not triggerable via an integration or
unit test.

Assisted-by: Claude Code: opus-5.5



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list