Index: src/runtime/runtime-strings.cc |
diff --git a/src/runtime/runtime-strings.cc b/src/runtime/runtime-strings.cc |
index 78b4ed227bd75776659a66410f3e37efc5687af1..e99ae9bbdd960a3528c1f8da4ec1be8fa9db986e 100644 |
--- a/src/runtime/runtime-strings.cc |
+++ b/src/runtime/runtime-strings.cc |
@@ -292,11 +292,13 @@ RUNTIME_FUNCTION(Runtime_SubString) { |
CONVERT_SMI_ARG_CHECKED(to_number, 2); |
start = from_number; |
end = to_number; |
- } else { |
+ } else if (args[1]->IsNumber() && args[2]->IsNumber()) { |
CONVERT_DOUBLE_ARG_CHECKED(from_number, 1); |
CONVERT_DOUBLE_ARG_CHECKED(to_number, 2); |
start = FastD2IChecked(from_number); |
end = FastD2IChecked(to_number); |
+ } else { |
+ return isolate->ThrowIllegalOperation(); |
} |
// The following condition is intentionally robust because the SubStringStub |
// delegates here and we test this in cctest/test-strings/RobustSubStringStub. |