[PATCH] D37331: [ELF] Prevent crash with binary inputs with non-ascii file names
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 1 09:02:16 PDT 2017
jhenderson added inline comments.
================
Comment at: ELF/InputFiles.cpp:934
for (size_t I = 0; I < S.size(); ++I)
- if (!isalnum(S[I]))
+ if (!isalnum(static_cast<unsigned char>(S[I])))
S[I] = '_';
----------------
ruiu wrote:
> isalnum might be locale-aware, so it is probably not safe to use here in the first place. Doing it manually (i.e. `'a' <= S[I] <= 'z' || 'A' <= S[I] <= 'Z' || '0' <= S[I] <= '0'` ) seems better.
isalnum is locale aware, but as far as I can see, we never change the locale away from the default C locale, so do we need to worry about it?
https://reviews.llvm.org/D37331
More information about the llvm-commits
mailing list