]> granicus.if.org Git - llvm/commit
[llvm-objcopy] Fix latent bug that allowed some Sections to be improperly cast to...
authorJake Ehrlich <jakehehrlich@google.com>
Tue, 10 Oct 2017 21:28:22 +0000 (21:28 +0000)
committerJake Ehrlich <jakehehrlich@google.com>
Tue, 10 Oct 2017 21:28:22 +0000 (21:28 +0000)
commitf2c4679069ec6de63a71bcedb163b48134d009c8
tree610b09932cc3528e702c60ae4312349cb699e199
parent5c1b4435094258dd2c8a560fe1e583b1bf03b8d8
[llvm-objcopy] Fix latent bug that allowed some Sections to be improperly cast to StringTableSections

If a Section had Type SHT_STRTAB (which could happen if you had a
.dynstr section) it was possible to cast Section to StringTableSection
and get away with any operation that was supported by SectionBase
without it being noticed. This change makes this bug easier to notice
and fixes it where it occurred. It also made me realize that there was
some duplication of efforts in the loop that calls ::initialize. These
issues are all fixed by this change.

Differential Revision: https://reviews.llvm.org/D38329

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315372 91177308-0d34-0410-b5e6-96231b3b80d8
tools/llvm-objcopy/Object.cpp
tools/llvm-objcopy/Object.h