From b39e1df7046e6db8aa32166d5c82b3c9d2e39075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 21 Feb 2019 11:21:41 +0100 Subject: 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. --- core/variant_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/variant_parser.cpp') diff --git a/core/variant_parser.cpp b/core/variant_parser.cpp index 716e5499e3..0056fc75b6 100644 --- a/core/variant_parser.cpp +++ b/core/variant_parser.cpp @@ -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: { -- cgit v1.2.3