godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.74k stars 575 forks source link

Fix crash in `ClassDB::add_virtual_method()` if arguments metadata is the wrong size #1581

Closed dsnopek closed 1 week ago

dsnopek commented 2 months ago

Fixes https://github.com/godotengine/godot-cpp/issues/1580

However, this shouldn't ever happen, if developers use the GDVIRTUAL*() macros, which will always call this with arguments metadata of the correct size.

Ivorforce commented 1 month ago

If I understand it correctly, the handled failure case here would be a developer error. I would argue instead of silently failing, we should check for argument congruity before the loop and hard-fail on problems instead. Or at least, log an error if a problem is detected.

dsnopek commented 2 weeks ago

Discussed at the GDExtension meeting: we agreed on adding a warning if the argument and argument metadata count don't match.

dsnopek commented 2 weeks ago

Added a warning as discussed at the meeting