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

Unified Diff: runtime/bin/socket_patch.dart

Issue 18500006: dart:io | Pass errors from multithreaded encryption back to Dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Compile libssl_dart without DEBUG defined. Created 7 years, 5 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 | « runtime/bin/secure_socket.cc ('k') | sdk/lib/io/secure_socket.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_patch.dart
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index cc0a6e339abb1f6fe8eda9a31b5735c0a25718c2..da10ad773611ea549f6947f4066367c71cefba91 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -393,7 +393,12 @@ class _NativeSocket extends NativeFieldWrapperClass1 {
int write(List<int> buffer, int offset, int bytes) {
if (buffer is! List) throw new ArgumentError();
if (offset == null) offset = 0;
- if (bytes == null) bytes = buffer.length;
+ if (bytes == null) {
+ if (offset > buffer.length) {
+ throw new RangeError.value(offset);
+ }
+ bytes = buffer.length - offset;
+ }
if (offset < 0) throw new RangeError.value(offset);
if (bytes < 0) throw new RangeError.value(bytes);
if ((offset + bytes) > buffer.length) {
« no previous file with comments | « runtime/bin/secure_socket.cc ('k') | sdk/lib/io/secure_socket.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698