Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(607)

Unified Diff: src/typing-asm.cc

Issue 1691723004: Only allow |0 and *1.0 for asm validator foreign variables. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/cctest/test-asm-validator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/typing-asm.cc
diff --git a/src/typing-asm.cc b/src/typing-asm.cc
index 3eb986c3cf1e92bf637f3750e2c9d578c9ca4292..db9558f20837cff8272a356f6342da0a3dfd648f 100644
--- a/src/typing-asm.cc
+++ b/src/typing-asm.cc
@@ -1121,6 +1121,18 @@ void AsmTyper::VisitBinaryOperation(BinaryOperation* expr) {
!expr->right()->IsLiteral()) {
FAIL(expr, "illegal computation inside module body");
}
+ DCHECK(expr->right()->AsLiteral() != nullptr);
+ const AstValue* right_value = expr->right()->AsLiteral()->raw_value();
+ if (expr->op() == Token::BIT_OR) {
+ if (right_value->AsNumber() != 0.0 || right_value->ContainsDot()) {
+ FAIL(expr, "illegal integer annotation value");
+ }
+ }
+ if (expr->op() == Token::MUL) {
+ if (right_value->AsNumber() != 1.0 && right_value->ContainsDot()) {
+ FAIL(expr, "illegal double annotation value");
+ }
+ }
}
switch (expr->op()) {
case Token::COMMA: {
« no previous file with comments | « no previous file | test/cctest/test-asm-validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698