ladybird/Userland/Libraries/LibJS
Daniel Bertalan 12dc2c2079 LibJS: Fix wraparound UB in Value::to_u{8,16}
If we call these two functions on a negative value, undefined behavior
occurs due to casting a negative double to an unsigned integer. These
functions are defined to perform modular arithmetic, so negative values
can be fixed up by adding 2^8/2^16.

The reason why this step is not mentioned in ECMA-262 is that it defines
modular arithmetic so that `x mod m` had the same sign as `m`, while
LibM's `fmod(x, m)` copies `x`'s sign.

This issue was found by UBSAN with the Clang toolchain.
2021-08-08 10:55:36 +02:00
..
Bytecode LibJS: Remove unused header includes 2021-08-01 08:10:16 +02:00
Heap LibJS: Remove unused header includes 2021-08-01 08:10:16 +02:00
Runtime LibJS: Fix wraparound UB in Value::to_u{8,16} 2021-08-08 10:55:36 +02:00
Tests LibJS: Implement Temporal.Instant.prototype.subtract() 2021-08-07 13:10:35 +01:00
AST.cpp LibJS: Parse RegExp literals at AST creation time, not execution time 2021-07-30 21:26:31 +01:00
AST.h LibJS: Parse RegExp literals at AST creation time, not execution time 2021-07-30 21:26:31 +01:00
CMakeLists.txt LibJS: Start implementing Temporal.ZonedDateTime 2021-08-01 20:31:31 +01:00
Console.cpp LibJS: Rename CallFrame => ExecutionContext 2021-06-24 19:28:00 +02:00
Console.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Forward.h LibJS: Start implementing Temporal.ZonedDateTime 2021-08-01 20:31:31 +01:00
Interpreter.cpp LibJS: Remove unused header includes 2021-08-01 08:10:16 +02:00
Interpreter.h LibJS: Drop "Record" suffix from all the *Environment record classes 2021-07-01 12:28:57 +02:00
Lexer.cpp LibJS: Implement parsing and evaluation for AssignmentPatterns 2021-07-11 21:41:54 +01:00
Lexer.h LibJS+LibCrypto: Allow '_' as a numeric literal separator :^) 2021-06-26 16:30:35 +02:00
MarkupGenerator.cpp LibJS: Remove unused includes out of Cell.h, move to the users 2021-08-01 08:10:16 +02:00
MarkupGenerator.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Parser.cpp Userland: Make use of container version of any_of 2021-08-02 00:37:18 +02:00
Parser.h LibJS: Handle strict mode for functions more correctly 2021-07-20 23:45:28 +02:00
SourceRange.h LibJS: Implement parsing and evaluation for AssignmentPatterns 2021-07-11 21:41:54 +01:00
SyntaxHighlighter.cpp LibJS: Remove unused header includes 2021-08-01 08:10:16 +02:00
SyntaxHighlighter.h LibWeb+LibSyntax: Implement nested syntax highlighters 2021-06-07 14:45:49 +04:30
Token.cpp LibJS: Decode UTF-16 surrogate pairs during string literal construction 2021-08-04 11:18:24 +02:00
Token.h LibJS: Implement parsing and evaluation for AssignmentPatterns 2021-07-11 21:41:54 +01:00