diff options
author | Conrad Pankoff <deoxxa@fknsrs.biz> | 2019-09-02 15:32:22 +1000 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-02 08:29:21 +0200 |
commit | 40daefd3dc56e306f544e383a940885ce035ba51 (patch) | |
tree | 49c178a089d4aa11a6342ae4f6e816b7f60e070b /AK/PrintfImplementation.h | |
parent | a92939b7660bf01563dd55f1584bea3cae14b32b (diff) | |
download | serenity-40daefd3dc56e306f544e383a940885ce035ba51.zip |
AK: Abort on unknown printf formatting characters
Right now if we encounter an unknown character, printf (and its related
functions) fail in a really bad way, where they forget to pull things off
the stack. This usually leads to a crash somewhere else, which is hard to
debug.
This patch makes printf abort as soon as it encounters a formatting
character that it can't handle. This is not the optimal solution, but it
is an improvement for debugging.
Diffstat (limited to 'AK/PrintfImplementation.h')
-rw-r--r-- | AK/PrintfImplementation.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/AK/PrintfImplementation.h b/AK/PrintfImplementation.h index 43e4aa7d63..333a3210f2 100644 --- a/AK/PrintfImplementation.h +++ b/AK/PrintfImplementation.h @@ -1,5 +1,6 @@ #pragma once +#include <AK/Assertions.h> #include <AK/Types.h> #include <stdarg.h> @@ -349,6 +350,8 @@ template<typename PutChFunc> case 'p': ret += print_hex(putch, bufptr, va_arg(ap, u32), *p == 'P', true, false, true, 8); break; + default: + ASSERT_NOT_REACHED(); } } else { putch(bufptr, *p); |