Skip to content

fix: leftover resource id stoul abort - #4

Open
tonycoder-hub wants to merge 1 commit into
openharmony:masterfrom
tonycoder-hub:cursor/fix-resource-id-stoul-leftover
Open

fix: leftover resource id stoul abort#4
tonycoder-hub wants to merge 1 commit into
openharmony:masterfrom
tonycoder-hub:cursor/fix-resource-id-stoul-leftover

Conversation

@tonycoder-hub

Copy link
Copy Markdown

Summary

  • GetResourceId in js_sceneview.cpp / component3d_modifier.cpp matches resource://.../([0-9]+).ext then calls std::stoul.
  • [0-9]+ is unbounded, so a long all-digit resource id still throws std::out_of_range and can abort ACE.
  • Parse with from_chars and reject overflow/junk. Same leftover class as the already-hardened image_loader.cpp digit-length check.

Test plan

  • Host+asan parse_resource_uint32 (g++ -std=c++17 -O0 -g -fsanitize=address,undefined): empty / junk / overflow / 0 / 42 / UINT32_MAX

Signed-off-by: Tony Coder 407243179@qq.com

GetResourceId matches [0-9]+ then stoul; a long all-digit resource id
still throws and can abort ACE.
Parse with from_chars and reject overflow/junk.

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