Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check arguments before calling bh_hash_map_find #3055

Merged
merged 2 commits into from
Jan 19, 2024

Conversation

wenyongh
Copy link
Contributor

Check whether the arguments are NULL before calling bh_hash_map_find,
or lots of "HashMap find elem failed: map or key is NULL" warnings may
be dumped. Reported in #3053.

@@ -176,7 +176,7 @@ acquire_wait_info(void *address, AtomicWaitNode *wait_node)
AtomicWaitInfo *wait_info = NULL;
bh_list_status ret;

if (address)
if (wait_map && address) /* avoid passing NULL to bh_hash_map_find */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as i understand, "address" here can't be NULL.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right, here the address comes from opcode atomic.wait32, atomic.wait64 and atomic.notify, all of them operate on an address inside the linear memory, which should not be NULL. I changed to bh_assert instead.

Copy link
Collaborator

@yamt yamt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@wenyongh wenyongh merged commit ec6d9cb into bytecodealliance:main Jan 19, 2024
405 checks passed
@wenyongh wenyongh deleted the fix_call_hashmap_find branch January 19, 2024 12:38
victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this pull request May 27, 2024
Check whether the arguments are NULL before calling bh_hash_map_find,
or lots of "HashMap find elem failed: map or key is NULL" warnings may
be dumped. Reported in bytecodealliance#3053.
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.

2 participants