Skip to content

fix: validate numeric and size inputs in the crash handler, power helper and IME popup - #51

Open
perlowja wants to merge 3 commits into
singularityos-lab:mainfrom
ncz-os:fix/harden-helper-inputs
Open

perlowja wants to merge 3 commits into
singularityos-lab:mainfrom
ncz-os:fix/harden-helper-inputs

Conversation

@perlowja

Copy link
Copy Markdown
Contributor

Range and size checks on inputs that previously went unchecked in three places:

  • crash-handler: reject a negative timestamp and uid/gid values that do not fit uid_t/gid_t, cap max_core_mb so the megabyte-to-byte conversion cannot overflow, and stop growing the entry list when the doubled capacity would overflow.
  • power-helper: fail when a sysfs path does not fit its buffer, and reject conversion errors when parsing the charge limit and the charge start threshold.
  • wayland/ime: require a positive stride of at least width * 4 and a width and height whose buffer size fits an int32_t before the popup buffer is created.

Checked with gcc -Wall -Wextra -fsyntax-only on the three files (ime.c with the generated Wayland protocol headers and the gtk4 cflags): no warnings. A full meson build needs valac and was not run.

Generative AI assistance

AI assistance: disclosed

Assisted-by: codex:gpt-6-luna
AI-Scope: Generated the range checks on the numeric arguments and the allocation growth guard from a list of static-analysis sites; reviewed by a human before submission.
Assisted-by: codex:gpt-6-luna
AI-Scope: Generated the path-length and strtol error checks from a list of static-analysis sites; reviewed by a human before submission.
Assisted-by: codex:gpt-6-luna
AI-Scope: Generated the stride and size bounds check from a list of static-analysis sites; reviewed by a human before submission.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant