Skip to content

Commit 94be433

Browse files
GeorgNeismibrunin
authored andcommitted
[Backport] CVE-2021-21220: Insufficient validation of untrusted input in V8 for x86_64
Cherry-pick of patch originally reviewed on https://chromium-review.googlesource.com/c/v8/v8/+/2821959: Fix bug in InstructionSelector::ChangeInt32ToInt64 (cherry picked from commit 02f84c745fc0cae5927a66dc4a3e81334e8f60a6) No-Try: true No-Presubmit: true No-Tree-Checks: true Bug: chromium:1196683 Change-Id: Ib4ea738b47b64edc81450583be4c80a41698c3d1 Commit-Queue: Georg Neis <[email protected]> Reviewed-by: Nico Hartmann <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#73903} Commit-Queue: Jana Grill <[email protected]> Reviewed-by: Georg Neis <[email protected]> Reviewed-by: Victor-Gabriel Savu <[email protected]> Cr-Commit-Position: refs/branch-heads/8.6@{#75} Cr-Branched-From: a64aed2333abf49e494d2a5ce24bbd14fff19f60-refs/heads/8.6.395@{#1} Cr-Branched-From: a626bc036236c9bf92ac7b87dc40c9e538b087e3-refs/heads/master@{#69472} Reviewed-by: Allan Sandfeld Jensen <[email protected]>
1 parent 2419957 commit 94be433

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

chromium/v8/src/compiler/backend/x64/instruction-selector-x64.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,9 @@ void InstructionSelector::VisitChangeInt32ToInt64(Node* node) {
12791279
opcode = load_rep.IsSigned() ? kX64Movsxwq : kX64Movzxwq;
12801280
break;
12811281
case MachineRepresentation::kWord32:
1282-
opcode = load_rep.IsSigned() ? kX64Movsxlq : kX64Movl;
1282+
// ChangeInt32ToInt64 must interpret its input as a _signed_ 32-bit
1283+
// integer, so here we must sign-extend the loaded value in any case.
1284+
opcode = kX64Movsxlq;
12831285
break;
12841286
default:
12851287
UNREACHABLE();

0 commit comments

Comments
 (0)