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

Unified Diff: mojo/public/cpp/bindings/tests/validation_unittest.cc

Issue 2312813002: Limit Mojo messages recursion depth (Closed)
Patch Set: Address review comments 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/cpp/bindings/tests/validation_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/validation_unittest.cc b/mojo/public/cpp/bindings/tests/validation_unittest.cc
index 7b7dcbeee2fe835194379387a7784bfb02dfa185..169ba578f700013b36fe92d484e5abf521473233 100644
--- a/mojo/public/cpp/bindings/tests/validation_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/validation_unittest.cc
@@ -424,6 +424,18 @@ TEST_F(ValidationTest, ResponseBoundsCheck) {
RunValidationTests("resp_boundscheck_", &validators);
}
+// Test that the client cannot send a message (e.g. a recursively defined
+// struct) so deep that the validation code blows the stack. The validation code
+// should check for this case and return a validation error.
+TEST_F(ValidationTest, RequestMaxRecursionDepth) {
+ DummyMessageReceiver dummy_receiver;
+ mojo::FilterChain validators(&dummy_receiver);
+ validators.Append<mojo::MessageHeaderValidator>();
+ validators.Append<ConformanceTestInterface::RequestValidator_>();
+
+ RunValidationTests("req_max_recursion_depth", &validators);
yzshen1 2016/09/07 16:51:20 Does it make sense to use the same prefix as other
tibell 2016/09/08 00:03:38 Done.
+}
+
// Test that InterfacePtr<X> applies the correct validators and they don't
// conflict with each other:
// - MessageHeaderValidator

Powered by Google App Engine
This is Rietveld 408576698