Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 #endif | 122 #endif |
| 123 | 123 |
| 124 // SECURITY_DCHECK and SECURITY_CHECK | 124 // SECURITY_DCHECK and SECURITY_CHECK |
| 125 // Use in places where failure of the assertion indicates a possible security | 125 // Use in places where failure of the assertion indicates a possible security |
| 126 // vulnerability. Classes of these vulnerabilities include bad casts, out of | 126 // vulnerability. Classes of these vulnerabilities include bad casts, out of |
| 127 // bounds accesses, use-after-frees, etc. Please be sure to file bugs for these | 127 // bounds accesses, use-after-frees, etc. Please be sure to file bugs for these |
| 128 // failures using the security template: | 128 // failures using the security template: |
| 129 // https://bugs.chromium.org/p/chromium/issues/entry?template=Security%20Bug | 129 // https://bugs.chromium.org/p/chromium/issues/entry?template=Security%20Bug |
| 130 #if ENABLE_SECURITY_ASSERT | 130 #if ENABLE_SECURITY_ASSERT |
| 131 #define SECURITY_DCHECK(condition) \ | 131 #define SECURITY_DCHECK(condition) \ |
| 132 LOG_IF(FATAL, !(condition)) << "Security DCHECK failed: " #condition ". " | 132 CHECK(condition) << "Security DCHECK failed: " #condition ". " |
|
tkent
2017/06/05 01:58:51
Do not replace this. LOG_IF and CHECK produce dif
gyuyoung
2017/06/05 02:32:29
Do you mean that LOG_IF() should be kept ?
tkent
2017/06/05 02:34:55
Yes.
| |
| 133 // A SECURITY_CHECK failure is actually not vulnerable. | 133 // A SECURITY_CHECK failure is actually not vulnerable. |
| 134 #define SECURITY_CHECK(condition) \ | 134 #define SECURITY_CHECK(condition) \ |
| 135 LOG_IF(FATAL, !(condition)) << "Security CHECK failed: " #condition ". " | 135 CHECK(condition) << "Security CHECK failed: " #condition ". " |
|
tkent
2017/06/05 01:58:51
Ditto.
| |
| 136 #else | 136 #else |
| 137 #define SECURITY_DCHECK(condition) ((void)0) | 137 #define SECURITY_DCHECK(condition) ((void)0) |
| 138 #define SECURITY_CHECK(condition) CHECK(condition) | 138 #define SECURITY_CHECK(condition) CHECK(condition) |
| 139 #endif | 139 #endif |
| 140 | 140 |
| 141 // DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES | 141 // DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES |
| 142 // Allow equality comparisons of Objects by reference or pointer, | 142 // Allow equality comparisons of Objects by reference or pointer, |
| 143 // interchangeably. This can be only used on types whose equality makes no | 143 // interchangeably. This can be only used on types whose equality makes no |
| 144 // other sense than pointer equality. | 144 // other sense than pointer equality. |
| 145 #define DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(thisType) \ | 145 #define DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(thisType) \ |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 return static_cast<thisType&>(argument); \ | 205 return static_cast<thisType&>(argument); \ |
| 206 } \ | 206 } \ |
| 207 inline const thisType& To##thisType##OrDie(const argumentType& argument) { \ | 207 inline const thisType& To##thisType##OrDie(const argumentType& argument) { \ |
| 208 CHECK(referencePredicate); \ | 208 CHECK(referencePredicate); \ |
| 209 return static_cast<const thisType&>(argument); \ | 209 return static_cast<const thisType&>(argument); \ |
| 210 } \ | 210 } \ |
| 211 void To##thisType##OrDie(const thisType*); \ | 211 void To##thisType##OrDie(const thisType*); \ |
| 212 void To##thisType##OrDie(const thisType&) | 212 void To##thisType##OrDie(const thisType&) |
| 213 | 213 |
| 214 #endif // WTF_Assertions_h | 214 #endif // WTF_Assertions_h |
| OLD | NEW |