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

Unified Diff: mojo/public/bindings/lib/bindings_internal.h

Issue 105133002: Add array bounds assertion and improve type conversion for empty strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweak Created 7 years 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 | « mojo/public/bindings/lib/bindings.cc ('k') | mojo/public/tests/bindings_type_conversion_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/bindings/lib/bindings_internal.h
diff --git a/mojo/public/bindings/lib/bindings_internal.h b/mojo/public/bindings/lib/bindings_internal.h
index 1d5a24a1e65352e6823aaa2bcf0776a8921bec25..c78db05830bd9a4820db46682cd84a92b3d4dc33 100644
--- a/mojo/public/bindings/lib/bindings_internal.h
+++ b/mojo/public/bindings/lib/bindings_internal.h
@@ -163,10 +163,12 @@ class Array_Data {
size_t size() const { return header_.num_elements; }
T& at(size_t offset) {
+ assert(offset < static_cast<size_t>(header_.num_elements));
return Traits::ToRef(storage()[offset]);
}
const T& at(size_t offset) const {
+ assert(offset < static_cast<size_t>(header_.num_elements));
return Traits::ToConstRef(storage()[offset]);
}
« no previous file with comments | « mojo/public/bindings/lib/bindings.cc ('k') | mojo/public/tests/bindings_type_conversion_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698