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

Unified Diff: content/common/cc_messages.cc

Issue 196423027: Move SoftwareFrameData overflow checks to the IPC code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: softwareframesize: Created 6 years, 9 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 | « content/common/cc_messages.h ('k') | content/common/cc_messages_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/cc_messages.cc
diff --git a/content/common/cc_messages.cc b/content/common/cc_messages.cc
index fef8ebcd4603893f7c79c89086fec777df23afe2..40e2441416c76e9807bc8c5914e95a8e8897222e 100644
--- a/content/common/cc_messages.cc
+++ b/content/common/cc_messages.cc
@@ -753,4 +753,42 @@ void ParamTraits<cc::DelegatedFrameData>::Log(const param_type& p,
l->append("])");
}
+void ParamTraits<cc::SoftwareFrameData>::Write(Message* m,
+ const param_type& p) {
+ DCHECK(p.CheckedSizeInBytes().IsValid());
+
+ m->Reserve(sizeof(cc::SoftwareFrameData));
+ WriteParam(m, p.id);
+ WriteParam(m, p.size);
+ WriteParam(m, p.damage_rect);
+ WriteParam(m, p.handle);
+}
+
+bool ParamTraits<cc::SoftwareFrameData>::Read(const Message* m,
+ PickleIterator* iter,
+ param_type* p) {
+ if (!ReadParam(m, iter, &p->id))
+ return false;
+ if (!ReadParam(m, iter, &p->size) || !p->CheckedSizeInBytes().IsValid())
+ return false;
+ if (!ReadParam(m, iter, &p->damage_rect))
+ return false;
+ if (!ReadParam(m, iter, &p->handle))
+ return false;
+ return true;
+}
+
+void ParamTraits<cc::SoftwareFrameData>::Log(const param_type& p,
+ std::string* l) {
+ l->append("SoftwareFrameData(");
+ LogParam(p.id, l);
+ l->append(", ");
+ LogParam(p.size, l);
+ l->append(", ");
+ LogParam(p.damage_rect, l);
+ l->append(", ");
+ LogParam(p.handle, l);
+ l->append(")");
+}
+
} // namespace IPC
« no previous file with comments | « content/common/cc_messages.h ('k') | content/common/cc_messages_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698