mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-10-07 06:57:20 +00:00
Update quickjs (#890)
Includes additional fixes from main repo's unmerged PRs: - quickjs#132: Fix undefined behavior: shift 32 bits for uint32_t in bf_set_ui - quickjs#171: Fix locale-aware representation of hours in Date class - quickjs#182: Fix stack overflow in CVE-2023-31922
This commit is contained in:
parent
4b7ba9a4c5
commit
879bb84244
12 changed files with 2330 additions and 2182 deletions
6
third_party/quickjs/libbf.c
vendored
6
third_party/quickjs/libbf.c
vendored
|
@ -240,8 +240,12 @@ int bf_set_ui(bf_t *r, uint64_t a)
|
|||
a0 = a;
|
||||
a1 = a >> 32;
|
||||
shift = clz(a1);
|
||||
/* shift < 32 because a > 0xffffffff */
|
||||
r->tab[0] = a0 << shift;
|
||||
r->tab[1] = (a1 << shift) | (a0 >> (LIMB_BITS - shift));
|
||||
if (shift == 0)
|
||||
r->tab[1] = a1;
|
||||
else
|
||||
r->tab[1] = (a1 << shift) | (a0 >> (LIMB_BITS - shift));
|
||||
r->expn = 2 * LIMB_BITS - shift;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue