summaryrefslogtreecommitdiff
path: root/core/variant_op.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/variant_op.cpp')
-rw-r--r--core/variant_op.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/core/variant_op.cpp b/core/variant_op.cpp
index ea9e29e744..6caa224cfe 100644
--- a/core/variant_op.cpp
+++ b/core/variant_op.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -1118,6 +1118,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
CASE_TYPE(math, OP_SHIFT_LEFT, INT) {
if (p_b.type != INT)
_RETURN_FAIL;
+ if (p_b._data._int < 0 || p_b._data._int >= 64)
+ _RETURN_FAIL;
_RETURN(p_a._data._int << p_b._data._int);
}
@@ -1129,6 +1131,8 @@ void Variant::evaluate(const Operator &p_op, const Variant &p_a,
CASE_TYPE(math, OP_SHIFT_RIGHT, INT) {
if (p_b.type != INT)
_RETURN_FAIL;
+ if (p_b._data._int < 0 || p_b._data._int >= 64)
+ _RETURN_FAIL;
_RETURN(p_a._data._int >> p_b._data._int);
}