[PATCH] D48271: [llvm-readobj] Fix printing format
Adrian McCarthy via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 10 11:00:18 PDT 2018
amccarth added inline comments.
================
Comment at: tools/llvm-readobj/ELFDumper.cpp:3280
+ for (char C : S)
+ W << (isprint(C) ? C : '.');
+}
----------------
The behavior of isprint is undefined if the value is not representable as an unsigned char. Since char on Windows is signed (by default), this means that some bytes could be negative, which is not representable and an unsigned char.
I think the safest thing to do is to cast `C` to `unsigned char`.
Repository:
rL LLVM
https://reviews.llvm.org/D48271
More information about the llvm-commits
mailing list