[all-commits] [llvm/llvm-project] ac42b0: [clang][modules] Guard against bad -fmodule-file m...

Naveen Seth Hanig via All-commits all-commits at lists.llvm.org
Mon Apr 7 20:03:19 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ac42b083f104442e12393ff09929a1add881010d
      https://github.com/llvm/llvm-project/commit/ac42b083f104442e12393ff09929a1add881010d
  Author: Naveen Seth Hanig <naveen.hanig at outlook.com>
  Date:   2025-04-08 (Tue, 08 Apr 2025)

  Changed paths:
    M clang/lib/Serialization/ASTReader.cpp
    A clang/test/Modules/fmodule-file-mismatch.cppm

  Log Message:
  -----------
  [clang][modules] Guard against bad -fmodule-file mappings (#132059) (#133462)

Fix https://github.com/llvm/llvm-project/issues/132059.

Providing incorrect mappings via `-fmodule-file=<name>=<path/to/bmi>`
can crash the compiler when loading a module that imports an
incorrectly mapped module.

The crash occurs during AST body deserialization, when the compiler
attempts to resolve remappings using the `ModuleFile` from the
incorrectly mapped module's BMI file.
The cause is an invalid access into an incorrectly loaded
`ModuleFile`.

This commit fixes the issue by verifying the identity of the imported
module.



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