Skip to content

linux, pcp: cast to unsigned char for ctype functions - #2117

Merged
BenBE merged 1 commit into
htop-dev:mainfrom
prownd:linux-pcp-cast-to-unsigned-char-for-ctype-functions-s01
Sep 20, 2026
Merged

BenBE merged 1 commit into
htop-dev:mainfrom
prownd:linux-pcp-cast-to-unsigned-char-for-ctype-functions-s01

Conversation

@prownd

@prownd prownd commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Two leftovers passing a plain char to <ctype.h>, which is undefined for negative values. LinuxProcessTable_readStatusFile() is inconsistent with the three isdigit() calls surrounding it in the same loop.

Two leftovers passing a plain char to <ctype.h>, which is undefined for
negative values.  LinuxProcessTable_readStatusFile() is inconsistent
with the three isdigit() calls surrounding it in the same loop.

Assisted-by: Claude Opus 5
Signed-off-by: hanjinpeng <hanjinpeng@kylinos.cn>
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 8be1c7e1-115e-48d5-a269-0850ad077c5a

📥 Commits

Reviewing files that changed from the base of the PR and between 763e498 and a6e35d3.

📒 Files selected for processing (2)
  • linux/LinuxProcessTable.c
  • pcp/Metric.c

Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The change updates two ctype calls. LinuxProcessTable_readStatusFile now casts the value passed to isdigit to unsigned char. Metric_lookupText now casts the first description byte before passing it to toupper. These changes address high-bit character values without changing normal parsing or formatting behavior.

Suggested reviewers: benbe

Priority: ⬇️ Low

Change: Bug fix


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

High-bit bytes now pass with care
Ctype calls find safe values there
Digits parse without surprise
Text keeps its proper guise
Two small casts make behavior wise

Comment @coderabbitai help to get the list of available commands.

@BenBE BenBE added code quality ♻️ Code quality enhancement Linux 🐧 Linux related issues labels Sep 20, 2026
@BenBE BenBE added this to the 3.6.0 milestone Sep 20, 2026
@BenBE BenBE added BSD 🐡 Issues related to *BSD PCP PCP related issues labels Sep 20, 2026
@BenBE
BenBE merged commit 4e826b9 into htop-dev:main Sep 20, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BSD 🐡 Issues related to *BSD code quality ♻️ Code quality enhancement Linux 🐧 Linux related issues PCP PCP related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants