godotengine / godotengine/godot-cpp
Number of given arguments should be checked in the method wrapper function
- Lingua principale
- C++
- Stelle
- 2.7k
- Fork
- 810
- Merge medio
- 1g 3h
- PR unite (30g)
- 8
Descrizione
Here in `__wrapped_method`, it should be checked that `num_args` is equal to, or at least equal to or larger than `sizeof...(As)`: https://github.com/GodotNativeTools/godot-cpp/blob/master/include/core/Godot.hpp#L197
If `num_args` is less than the number of arguments expected by the wrapped method, invalid reads will happen, because in `_WrappedMethod::apply`, the arguments are dereferenced without checking the bounds:
```cpp
template
void apply(Variant *ret, T *obj, Variant **args, __Sequence) {
*ret = (obj->*f)(_ArgCast::_arg_cast(*args[I])...);
}
```
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia in include/core/Godot.hpp, in corrispondenza di __wrapped_method, e verifica come invoca _WrappedMethod::apply. Conferma che il numero di argomenti venga controllato prima che _WrappedMethod::apply dereferenzi l’array degli argomenti, in modo che le chiamate con un numero insufficiente di argomenti non possano causare letture non valide.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp
- Ambito
- game-dev
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100