diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-06-30 19:50:23 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-30 19:06:01 +0200 |
commit | 38b8fa8f3e2f0ff0174b9cb9bd7345b74b155931 (patch) | |
tree | 946f0d28b6d1924f0e493299b5bb4a6cf19e3ec6 /Userland/Libraries/LibJS/Runtime | |
parent | 2c2cf90661ba540e9cc077c9908a732f4ef43bb3 (diff) | |
download | serenity-38b8fa8f3e2f0ff0174b9cb9bd7345b74b155931.zip |
LibJS: Ensure shift values in left_shift are modded by 32
This is equivalent to 58d6a2d0192b7860ecb2edb4aa5d36b389213a15 but for
the left shift operation.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Value.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Value.cpp b/Userland/Libraries/LibJS/Runtime/Value.cpp index dafa672468..0c8742b2f0 100644 --- a/Userland/Libraries/LibJS/Runtime/Value.cpp +++ b/Userland/Libraries/LibJS/Runtime/Value.cpp @@ -993,7 +993,7 @@ Value left_shift(GlobalObject& global_object, Value lhs, Value rhs) return lhs_numeric; // Ok, so this performs toNumber() again but that "can't" throw auto lhs_i32 = lhs_numeric.to_i32(global_object); - auto rhs_u32 = rhs_numeric.to_u32(global_object); + auto rhs_u32 = rhs_numeric.to_u32(global_object) % 32; return Value(lhs_i32 << rhs_u32); } if (both_bigint(lhs_numeric, rhs_numeric)) { |