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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl

Issue 2312813002: Limit Mojo messages recursion depth (Closed)
Patch Set: Update comment to match arg name change Created 4 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
Index: mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl
index 374b0976b1831b66b13f96b0674ba0b07fd5a538..38dbde1e4aff90f6945d6171ee39512888709972 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/struct_definition.tmpl
@@ -5,6 +5,15 @@
bool {{class_name}}::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) {
+ mojo::internal::ValidationContext::ScopedDepthTracker depth_tracker(
yzshen1 2016/09/06 17:03:10 This is not the only place: we need to consider th
tibell 2016/09/07 05:41:20 Done. I was aware of this. The reason I didn't do
+ validation_context);
+ if (validation_context->ExceedsMaxDepth()) {
+ ReportValidationError(
+ validation_context,
+ mojo::internal::VALIDATION_ERROR_MAX_RECURSION_DEPTH);
+ return false;
+ }
+
if (!data)
return true;

Powered by Google App Engine
This is Rietveld 408576698