mirror of https://github.com/xzeldon/htop.git
Linux: silence UBSAN implicit conversions
pgrp and session might be -1 linux/LinuxProcessList.c:312:20: runtime error: implicit conversion from type 'unsigned long' of value 18446744073709551615 (64-bit, unsigned) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:312:20 in linux/LinuxProcessList.c:314:23: runtime error: implicit conversion from type 'unsigned long' of value 18446744073709551615 (64-bit, unsigned) to type 'unsigned int' changed the value to 4294967295 (32-bit, unsigned) SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior linux/LinuxProcessList.c:314:23 in
This commit is contained in:
parent
1014e897a7
commit
7bfa466abe
|
@ -76,10 +76,10 @@ typedef struct Process_ {
|
||||||
pid_t tgid;
|
pid_t tgid;
|
||||||
|
|
||||||
/* Process group identifier */
|
/* Process group identifier */
|
||||||
unsigned int pgrp;
|
int pgrp;
|
||||||
|
|
||||||
/* Session identifier */
|
/* Session identifier */
|
||||||
unsigned int session;
|
int session;
|
||||||
|
|
||||||
/* Foreground group identifier of the controlling terminal */
|
/* Foreground group identifier of the controlling terminal */
|
||||||
int tpgid;
|
int tpgid;
|
||||||
|
|
|
@ -316,11 +316,11 @@ static bool LinuxProcessList_readStatFile(Process* process, openat_arg_t procFd,
|
||||||
location += 1;
|
location += 1;
|
||||||
|
|
||||||
/* (5) pgrp - %d */
|
/* (5) pgrp - %d */
|
||||||
process->pgrp = strtoul(location, &location, 10);
|
process->pgrp = strtol(location, &location, 10);
|
||||||
location += 1;
|
location += 1;
|
||||||
|
|
||||||
/* (6) session - %d */
|
/* (6) session - %d */
|
||||||
process->session = strtoul(location, &location, 10);
|
process->session = strtol(location, &location, 10);
|
||||||
location += 1;
|
location += 1;
|
||||||
|
|
||||||
/* (7) tty_nr - %d */
|
/* (7) tty_nr - %d */
|
||||||
|
|
Loading…
Reference in New Issue