Chromium Code Reviews| Index: runtime/lib/typed_data.cc |
| =================================================================== |
| --- runtime/lib/typed_data.cc (revision 23830) |
| +++ runtime/lib/typed_data.cc (working copy) |
| @@ -42,18 +42,12 @@ |
| // Checks to see if a length will not result in an OOM error. |
| static void LengthCheck(intptr_t len, intptr_t max) { |
| - if (len > max) { |
| + if (len < 0 || len > max) { |
| const String& error = String::Handle(String::NewFormatted( |
| - "insufficient memory to allocate a TypedData object of length (%"Pd")", |
| - len)); |
| + "Length (%"Pd") of TypedData object must be in range [0..%"Pd"]", |
| + len, max)); |
| const Array& args = Array::Handle(Array::New(1)); |
| args.SetAt(0, error); |
| - Exceptions::ThrowByType(Exceptions::kOutOfMemory, args); |
| - } else if (len < 0) { |
| - const String& error = String::Handle(String::NewFormatted( |
| - "%"Pd" must be greater than 0", len)); |
|
hausner
2013/06/11 20:20:14
Should the message include the word TypedData or w
siva
2013/06/11 20:33:39
It should be clear based on the stack trace.
Dropp
|
| - const Array& args = Array::Handle(Array::New(1)); |
| - args.SetAt(0, error); |
| Exceptions::ThrowByType(Exceptions::kArgument, args); |
| } |
| } |