[llvm-objcopy] Fix crash for binary input files with non-ascii names
authorJames Henderson <james.henderson@sony.com>
Tue, 23 Feb 2021 15:32:45 +0000 (15:32 +0000)
committerJames Henderson <james.henderson@sony.com>
Fri, 5 Mar 2021 08:57:40 +0000 (08:57 +0000)
commit076698154ad7cd36c590379ed09fdd14047b8244
tree7b433b17c79611b0351f5a2ed49df9ab9734691b
parent47c343d7685f4ce9d8013c2e7ed3e30869875f4d
[llvm-objcopy] Fix crash for binary input files with non-ascii names

The code was using the standard isalnum function which doesn't handle
values outside the non-ascii range. Switching to using llvm::isAlnum
instead ensures we don't provoke undefined behaviour, which can in some
cases result in crashes.

Reviewed by: MaskRay

Differential Revision: https://reviews.llvm.org/D97663
llvm/test/tools/llvm-objcopy/ELF/binary-input.test
llvm/tools/llvm-objcopy/ELF/Object.cpp