mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
pmc: Use isascii(3) to check if a character is ASCII
The previous check did not work on architectures where `char` is
unsigned as noted by GCC on aarch64:
usr.sbin/pmc/view.cc: In member function 'void pmcview::loadsymboltable(image*, Elf*, Elf_Scn*, GElf_Shdr*)':
usr.sbin/pmc/view.cc:627:38: error: comparison is always false due to limited range of data type [-Werror=type-limits]
627 | if (fname[i] < 0) {
| ~~~~~~~~~^~~
Reported by: GCC 15
This commit is contained in:
1 parent
8bea280f43
commit
82a3337952
1 file changed
+1
-1
@@ -624,7 +624,7 @@ pmcview::loadsymboltable(image *im, Elf *e, Elf_Scn *scn, GElf_Shdr *sh)
|
||||
|
||||
// XXX: Extra checks to make sure we don't get corrupted
|
||||
for (int i = 0; fname[i] != 0 && i < 32; i++) {
|
||||
if (fname[i] < 0) {
|
||||
if (!isascii(fname[i])) {
|
||||
printf("EEEK SYMBOL\n");
|
||||
printf("%s\n", fname);
|
||||
assert(false);
|
||||
|
||||
Reference in new issue
Block a user