aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/COFFObjectFile.cpp
diff options
context:
space:
mode:
authorPengxuan Zheng <pzheng@quicinc.com>2022-06-08 18:02:49 -0700
committerPengxuan Zheng <pzheng@quicinc.com>2022-06-09 12:58:28 -0700
commit064db243113ccac50ab3f8695f8f83a9e71efd3f (patch)
tree7adfa3c65428afdf5dee834060129a73a3631ce3 /llvm/lib/Object/COFFObjectFile.cpp
parent075990236f8f78defc705c8573a66321edccd63f (diff)
downloadllvm-064db243113ccac50ab3f8695f8f83a9e71efd3f.zip
llvm-064db243113ccac50ab3f8695f8f83a9e71efd3f.tar.gz
llvm-064db243113ccac50ab3f8695f8f83a9e71efd3f.tar.bz2
[Object][COFF] Fix section name parsing error when the name field is not null-padded
Some object files produced by Mirosoft tools contain sections whose name field is not fully null-padded at the end. Microsoft's dumpbin is able to print the section name correctly, but this causes parsing errors with LLVM tools. So far, this issue only seems to happen when the section name is longer than 8 bytes. In this case, the section name field contains a slash (/) followed by the offset into the string table, but the name field is not fully null-padded at the end. Reviewed By: mstorsjo Differential Revision: https://reviews.llvm.org/D127369
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r--llvm/lib/Object/COFFObjectFile.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp
index fe8fab23..e5013d77 100644
--- a/llvm/lib/Object/COFFObjectFile.cpp
+++ b/llvm/lib/Object/COFFObjectFile.cpp
@@ -1168,7 +1168,7 @@ COFFObjectFile::getSectionName(const coff_section *Sec) const {
return createStringError(object_error::parse_failed,
"invalid section name");
} else {
- if (Name.substr(1).getAsInteger(10, Offset))
+ if (Name.substr(1).consumeInteger(10, Offset))
return createStringError(object_error::parse_failed,
"invalid section name");
}