1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Fix VariantWriter overflow on 64-bit int

Integers in Godot are signed 64-bit ints (int64_t), but var2str used
int behind the scenes and would thus overflow after 2^31.

Also properly documented the actual bounds of int and the behaviour
when overflowing them.
This commit is contained in:
Rémi Verschelde
2019-02-21 11:21:41 +01:00
parent 16934c7411
commit b39e1df704
3 changed files with 23 additions and 8 deletions

View File

@@ -1597,7 +1597,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
} break;
case Variant::INT: {
p_store_string_func(p_store_string_ud, itos(p_variant.operator int()));
p_store_string_func(p_store_string_ud, itos(p_variant.operator int64_t()));
} break;
case Variant::REAL: {