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

Unified Diff: runtime/bin/file.cc

Issue 23532048: Checks for valid CObject lengths in native API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 3 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/dartutils.cc ('k') | runtime/include/dart_native_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file.cc
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
index bb6807102137f9875a58f93ab4fe1b81542b65b0..35ea5fc45e2a85d6883de302ef3f2789d421eda9 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -919,6 +919,7 @@ static CObject* FileReadRequest(const CObjectArray& request) {
if (!file->IsClosed()) {
int64_t length = CObjectInt32OrInt64ToInt64(request[2]);
Dart_CObject* io_buffer = CObject::NewIOBuffer(length);
+ ASSERT(io_buffer != NULL);
uint8_t* data = io_buffer->value.as_external_typed_data.data;
int64_t bytes_read = file->Read(data, length);
if (bytes_read >= 0) {
@@ -950,6 +951,7 @@ static CObject* FileReadIntoRequest(const CObjectArray& request) {
if (!file->IsClosed()) {
int64_t length = CObjectInt32OrInt64ToInt64(request[2]);
Dart_CObject* io_buffer = CObject::NewIOBuffer(length);
+ ASSERT(io_buffer != NULL);
uint8_t* data = io_buffer->value.as_external_typed_data.data;
int64_t bytes_read = file->Read(data, length);
if (bytes_read >= 0) {
« no previous file with comments | « runtime/bin/dartutils.cc ('k') | runtime/include/dart_native_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698