Repository: godot
Issue: Dynamic calls with wrong argument count crash the engine (Release mode)
Labels: discussion,topic:core,crash

### Tested versions

Godot 4.3-dev (I used 0f8c955c1ad19bef9d4d615681c647cbc5a495e1, should now be on `master`).

### System information

Windows 10

### Issue description

Using GDScript method `Object.call()` or GDExtension functions [`object_method_bind_call`](https://github.com/godotengine/godot/blob/2d0ee20ff30461b6b10f6fdfba87511a0ebc6642/core/extension/gdextension_interface.h#L2120-L2133) and [`variant_call`](https://github.com/godotengine/godot/blob/2d0ee20ff30461b6b10f6fdfba87511a0ebc6642/core/extension/gdextension_interface.h#L799-L814) with an incorrect argument count can lead to irrecoverable engine crashes, in Release mode.

I haven't labeled this issue since I'm not sure if it's an actual bug or by design. Some observations:
- `Object::call` and `Variant::call` are used for dynamic calls, using the "variant call" convention (as opposed to "ptrcall"). I was under the assumption that these are checked (and one would use ptrcall for speed), but this might not be true.
- There is a `GDExtensionCallError` output parameter on both methods in the C API. No indication from docs that this would not be used in Release.
- Godot seems to not provide any other API to do dynamic calls.

If this is indeed by design, then we should clarify the following things:
1. Can reflection still be used in Release builds, and how?
    - In particular, are dynamic checked calls supported or is this feature absent for exported games?
    - What are the differences from Debug mode across different reflection APIs?
2. This behavior should be documented for both GDScript and GDExtension.
    - For the latter, we might especially want to highlight that `GDExtensionCallError` has no use in Release builds.


### Steps to reproduce

Use a Godot 4.2 **Release** build (e.g. export templates).

Call `Node2D::set_position` _dynamically_ through the [GDExtension `variant_call` API](https://github.com/godotengine/godot/blob/2d0ee20ff30461b6b10f6fdfba87511a0ebc6642/core/extension/gdextension_interface.h#L799-L814). Deliberately do not provide the expected argument.

Rust code to visualize, but should be applicable to other bindings:
```rs
let node2d = Node2D::new_alloc();
let variant = Variant::from(node2d);
variant.call("set_position", &[]);
```

This will crash the engine with
```
ERROR: FATAL: Index p_index = -1 is out of bounds (size() = 0).
   at: CowData<class Variant>::get
```
and a weird exit code like -2147483645.


### Affected code

Problem seems to be here, in line 446 to be exact:

https://github.com/godotengine/godot/blob/2d0ee20ff30461b6b10f6fdfba87511a0ebc6642/core/variant/binder_common.h#L441-L448

With a debugger, I see following values:
```
i = 0
p_argcount = 0
dvs = 0
missing = 1
```
Thus, `i - p_argcount + (dvs - missing)` is `-1`, which is an invalid index. This crashes at `CRASH_BAD_INDEX` here:

https://github.com/godotengine/godot/blob/2d0ee20ff30461b6b10f6fdfba87511a0ebc6642/core/templates/cowdata.h#L157-L161

### Minimal reproduction project (MRP)

N/A