| 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 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));
|
| - const Array& args = Array::Handle(Array::New(1));
|
| - args.SetAt(0, error);
|
| Exceptions::ThrowByType(Exceptions::kArgument, args);
|
| }
|
| }
|
|
|