OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
6 #include "bin/io_buffer.h" | 6 #include "bin/io_buffer.h" |
7 #include "bin/log.h" | 7 #include "bin/log.h" |
8 #include "bin/platform.h" | 8 #include "bin/platform.h" |
9 #include "bin/process.h" | 9 #include "bin/process.h" |
10 #include "bin/socket.h" | 10 #include "bin/socket.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 intptr_t* length) { | 27 intptr_t* length) { |
28 static const intptr_t kMaxArgumentListLength = 1024 * 1024; | 28 static const intptr_t kMaxArgumentListLength = 1024 * 1024; |
29 ASSERT(Dart_IsList(strings)); | 29 ASSERT(Dart_IsList(strings)); |
30 intptr_t len = 0; | 30 intptr_t len = 0; |
31 Dart_Handle result = Dart_ListLength(strings, &len); | 31 Dart_Handle result = Dart_ListLength(strings, &len); |
32 if (Dart_IsError(result)) { | 32 if (Dart_IsError(result)) { |
33 Dart_PropagateError(result); | 33 Dart_PropagateError(result); |
34 } | 34 } |
35 // Protect against user-defined list implementations that can have | 35 // Protect against user-defined list implementations that can have |
36 // arbitrary length. | 36 // arbitrary length. |
37 if (len < 0 || len > kMaxArgumentListLength) { | 37 if ((len < 0) || (len > kMaxArgumentListLength)) { |
38 result = DartUtils::SetIntegerField(status_handle, "_errorCode", 0); | 38 result = DartUtils::SetIntegerField(status_handle, "_errorCode", 0); |
39 if (Dart_IsError(result)) { | 39 if (Dart_IsError(result)) { |
40 Dart_PropagateError(result); | 40 Dart_PropagateError(result); |
41 } | 41 } |
42 result = DartUtils::SetStringField( | 42 result = DartUtils::SetStringField( |
43 status_handle, "_errorMessage", "Max argument list length exceeded"); | 43 status_handle, "_errorMessage", "Max argument list length exceeded"); |
44 if (Dart_IsError(result)) { | 44 if (Dart_IsError(result)) { |
45 Dart_PropagateError(result); | 45 Dart_PropagateError(result); |
46 } | 46 } |
47 return NULL; | 47 return NULL; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 uint8_t* buffer = NULL; | 360 uint8_t* buffer = NULL; |
361 Dart_Handle external_array = IOBuffer::Allocate(system_len, &buffer); | 361 Dart_Handle external_array = IOBuffer::Allocate(system_len, &buffer); |
362 if (!Dart_IsError(external_array)) { | 362 if (!Dart_IsError(external_array)) { |
363 memmove(buffer, system_string, system_len); | 363 memmove(buffer, system_string, system_len); |
364 } | 364 } |
365 Dart_SetReturnValue(args, external_array); | 365 Dart_SetReturnValue(args, external_array); |
366 } | 366 } |
367 | 367 |
368 } // namespace bin | 368 } // namespace bin |
369 } // namespace dart | 369 } // namespace dart |
OLD | NEW |