Skip to content

fix: leftover Want marshalling atoll on long params - #1

Open
tonycoder-hub wants to merge 1 commit into
openharmony:masterfrom
tonycoder-hub:leftover-want-long-atoll
Open

fix: leftover Want marshalling atoll on long params#1
tonycoder-hub wants to merge 1 commit into
openharmony:masterfrom
tonycoder-hub:leftover-want-long-atoll

Conversation

@tonycoder-hub

Copy link
Copy Markdown

Summary

  • Want::GetLongParam / ArrayAddData parsed marshalled IPC string params with a digit-ish regex plus std::atoll. Overflow, empty, and trailing junk still converted (regex is not an overflow check), so Want extras can wrap/clamp into the wrong long.
  • Parse with std::from_chars (optional +, overflow-checked; keep previous in-range decimal/n.frac behavior). On failure log with ABILITYBASE_LOGE and return the default / skip the element.

Test plan

  • Host g++ -std=c++17 -fsanitize=address,undefined: valid 0/123/+123/-123/123.45/LLONG_MAX match atoll; reject empty, overflow, trailing junk, hex, and non-digits.
  • Existing Want GetLongParam marshalling tests still hold for in-range integer strings.

Want::GetLongParam/ArrayAddData parsed marshalled string params with
digit-ish regex plus std::atoll, so overflow/junk still converted.
Parse with std::from_chars and keep in-range values unchanged.

Signed-off-by: Tony Coder <407243179@qq.com>
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