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

Side by Side Diff: mojo/public/cpp/bindings/lib/validation_errors.h

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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // Two parallel arrays which are supposed to represent a map have different 63 // Two parallel arrays which are supposed to represent a map have different
64 // lengths. 64 // lengths.
65 VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP, 65 VALIDATION_ERROR_DIFFERENT_SIZED_ARRAYS_IN_MAP,
66 // Attempted to deserialize a tagged union with an unknown tag. 66 // Attempted to deserialize a tagged union with an unknown tag.
67 VALIDATION_ERROR_UNKNOWN_UNION_TAG, 67 VALIDATION_ERROR_UNKNOWN_UNION_TAG,
68 // A value of a non-extensible enum type is unknown. 68 // A value of a non-extensible enum type is unknown.
69 VALIDATION_ERROR_UNKNOWN_ENUM_VALUE, 69 VALIDATION_ERROR_UNKNOWN_ENUM_VALUE,
70 // Message deserialization failure, for example due to rejection by custom 70 // Message deserialization failure, for example due to rejection by custom
71 // validation logic. 71 // validation logic.
72 VALIDATION_ERROR_DESERIALIZATION_FAILED, 72 VALIDATION_ERROR_DESERIALIZATION_FAILED,
73 // The message contains a too deeply nested value, for example a recursively
74 // defined field which runtime value is too large.
75 VALIDATION_ERROR_MAX_RECURSION_DEPTH,
73 }; 76 };
74 77
75 const char* ValidationErrorToString(ValidationError error); 78 const char* ValidationErrorToString(ValidationError error);
76 79
77 void ReportValidationError(ValidationContext* context, 80 void ReportValidationError(ValidationContext* context,
78 ValidationError error, 81 ValidationError error,
79 const char* description = nullptr); 82 const char* description = nullptr);
80 83
81 void ReportValidationErrorForMessage( 84 void ReportValidationErrorForMessage(
82 mojo::Message* message, 85 mojo::Message* message,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // 141 //
139 // In non-debug build, does nothing (not even compiling |condition|). 142 // In non-debug build, does nothing (not even compiling |condition|).
140 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(condition, error, \ 143 #define MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(condition, error, \
141 description) \ 144 description) \
142 DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \ 145 DLOG_IF(FATAL, (condition) && !ReportSerializationWarning(error)) \
143 << "The outgoing message will trigger " \ 146 << "The outgoing message will trigger " \
144 << ValidationErrorToString(error) << " at the receiving side (" \ 147 << ValidationErrorToString(error) << " at the receiving side (" \
145 << description << ")."; 148 << description << ").";
146 149
147 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_ 150 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_VALIDATION_ERRORS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698