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

Unified Diff: runtime/vm/object.cc

Issue 9560001: Guard calls to ByteAddr when a ByteArray copy length is 0. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 | « no previous file | runtime/vm/object_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 753137c77e17768c15a95f5d0ad04336e989696f..fc552801a14d347a654e692f2366c76ed68dff2a 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -7828,7 +7828,9 @@ void ByteArray::Copy(uint8_t* dst,
ASSERT(Utils::RangeCheck(src_offset, length, src.Length()));
{
NoGCScope no_gc;
- memmove(dst, src.ByteAddr(src_offset), length);
+ if (length > 0) {
+ memmove(dst, src.ByteAddr(src_offset), length);
+ }
}
}
@@ -7840,7 +7842,9 @@ void ByteArray::Copy(const ByteArray& dst,
ASSERT(Utils::RangeCheck(dst_offset, length, dst.Length()));
{
NoGCScope no_gc;
- memmove(dst.ByteAddr(dst_offset), src, length);
+ if (length > 0) {
+ memmove(dst.ByteAddr(dst_offset), src, length);
+ }
}
}
@@ -7854,7 +7858,9 @@ void ByteArray::Copy(const ByteArray& dst,
ASSERT(Utils::RangeCheck(dst_offset, length, dst.Length()));
{
NoGCScope no_gc;
- memmove(dst.ByteAddr(dst_offset), src.ByteAddr(src_offset), length);
+ if (length > 0) {
+ memmove(dst.ByteAddr(dst_offset), src.ByteAddr(src_offset), length);
+ }
}
}
« no previous file with comments | « no previous file | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698