[all-commits] [llvm/llvm-project] 659a48: Detect against invalid variant index for LibStdC++...

jeffreytan81 via All-commits all-commits at lists.llvm.org
Tue Oct 17 17:26:18 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 659a48f25a96b7072b44d372c47385a2608f8671
      https://github.com/llvm/llvm-project/commit/659a48f25a96b7072b44d372c47385a2608f8671
  Author: jeffreytan81 <jeffreytan at meta.com>
  Date:   2023-10-17 (Tue, 17 Oct 2023)

  Changed paths:
    M lldb/examples/synthetic/gnu_libstdcpp.py
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
    M lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/variant/TestDataFormatterLibStdcxxVariant.py

  Log Message:
  -----------
  Detect against invalid variant index for LibStdC++ std::variant data formatters (#69253)

https://github.com/llvm/llvm-project/pull/68012/files added new data
formatters for LibStdC++ std::variant.

However, this formatter can crash if std::variant's index field has
invalid value (exceeds the number of template arguments).
This can happen if the current IP stops at a place std::variant is not
initialized yet.

This patch fixes the crash by ensuring the index is a valid value.

---------

Co-authored-by: jeffreytan81 <jeffreytan at fb.com>




More information about the All-commits mailing list