[llvm] [yaml2obj] Don't use uninitialized Type (PR #123274)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 17 15:31:08 PST 2025
================
@@ -1599,8 +1599,11 @@ void MappingTraits<std::unique_ptr<ELFYAML::Chunk>>::mapping(
// When the Type string does not have a "SHT_" prefix, we know it is not a
// description of a regular ELF output section.
TypeStr = getStringValue(IO, "Type");
- if (TypeStr.starts_with("SHT_") || isInteger(TypeStr))
+ if (TypeStr.starts_with("SHT_") || isInteger(TypeStr)) {
IO.mapRequired("Type", Type);
+ if (IO.error())
+ Type = ELF::SHT_NULL;
+ }
----------------
vitalybuka wrote:
On `!IO.error()` mapRequired will set `Type`, it's output arg.
https://github.com/llvm/llvm-project/pull/123274
More information about the llvm-commits
mailing list