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

Side by Side Diff: third_party/WebKit/Source/wtf/Assertions.h

Issue 2361843002: Don't write to an arbitrary address before crashing in blink's CRASH macro (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 #endif 149 #endif
150 #endif 150 #endif
151 151
152 // CRASH() - Raises a fatal error resulting in program termination and 152 // CRASH() - Raises a fatal error resulting in program termination and
153 // triggering either the debugger or the crash reporter. 153 // triggering either the debugger or the crash reporter.
154 // 154 //
155 // Use CRASH() in response to known, unrecoverable errors like out-of-memory. 155 // Use CRASH() in response to known, unrecoverable errors like out-of-memory.
156 // Macro is enabled in both debug and release mode. 156 // Macro is enabled in both debug and release mode.
157 // To test for unknown errors and verify assumptions, use ASSERT instead, to 157 // To test for unknown errors and verify assumptions, use ASSERT instead, to
158 // avoid impacting performance in release builds. 158 // avoid impacting performance in release builds.
159 //
160 // Signals are ignored by the crash reporter on OS X so we must do better.
161 #ifndef CRASH 159 #ifndef CRASH
162 #if COMPILER(MSVC) 160 #if COMPILER(MSVC)
163 #define CRASH() (__debugbreak(), IMMEDIATE_CRASH()) 161 #define CRASH() (__debugbreak(), IMMEDIATE_CRASH())
164 #else 162 #else
165 #define CRASH() \ 163 #define CRASH() (WTFReportBacktrace(), IMMEDIATE_CRASH())
166 (WTFReportBacktrace(), (*(int*)0xfbadbeef = 0), IMMEDIATE_CRASH())
167 #endif 164 #endif
168 #endif 165 #endif
169 166
170 #if COMPILER(CLANG) 167 #if COMPILER(CLANG)
171 #define NO_RETURN_DUE_TO_CRASH NO_RETURN 168 #define NO_RETURN_DUE_TO_CRASH NO_RETURN
172 #else 169 #else
173 #define NO_RETURN_DUE_TO_CRASH 170 #define NO_RETURN_DUE_TO_CRASH
174 #endif 171 #endif
175 172
176 // ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED 173 // ASSERT, ASSERT_NOT_REACHED, ASSERT_UNUSED
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } \ 299 } \
303 inline const thisType& to##thisType(const argumentType& argumentName) \ 300 inline const thisType& to##thisType(const argumentType& argumentName) \
304 { \ 301 { \
305 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \ 302 ASSERT_WITH_SECURITY_IMPLICATION(referencePredicate); \
306 return static_cast<const thisType&>(argumentName); \ 303 return static_cast<const thisType&>(argumentName); \
307 } \ 304 } \
308 void to##thisType(const thisType*); \ 305 void to##thisType(const thisType*); \
309 void to##thisType(const thisType&) 306 void to##thisType(const thisType&)
310 307
311 #endif // WTF_Assertions_h 308 #endif // WTF_Assertions_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698