mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibCrypto: Protect the SignedBigInteger ctor against integer overflow
In particular, if given a value of -2147483648, we would invoke signed integer overflow (which is UB).
This commit is contained in:
parent
540c840755
commit
edd3b14ddf
Notes:
github-actions[bot]
2024-12-19 22:38:27 +00:00
Author: https://github.com/trflynn89
Commit: edd3b14ddf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2981
Reviewed-by: https://github.com/gmta ✅
2 changed files with 12 additions and 1 deletions
|
@ -21,7 +21,7 @@ public:
|
|||
requires(sizeof(T) <= sizeof(i32))
|
||||
SignedBigInteger(T value)
|
||||
: m_sign(value < 0)
|
||||
, m_unsigned_data(abs(static_cast<i32>(value)))
|
||||
, m_unsigned_data(static_cast<u32>(abs(static_cast<i64>(value))))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue