Fix argument metadata when binding methods #1509
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While there doesn't seem to be any runtime issues, this triggers the address sanitizer in a few ways, depending on what kind of method you're binding.
For a method like this, with a return value
you get a container overflow. It even reaches the Godot side of things, but the bug is caused by
godot-cpp
all the same: the argument metadata is invalid.A method like this, without a return value and with arguments
causes heap buffer overflow. The return value metadata is invalid.
Looks like this was introduced as is in #896, in commit e24b6b0. A similar method
get_arguments_info_list
had the same issue initially, but was corrected in b6ba0dc, all within the same PR.I can't say if this change has any unexpected side effects, or if it fixes any outstanding issues (quite possible, anything related to arguments can be affected, I guess?), but I can confirm that with it included there are no asan issues in my project anymore.