mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
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.
This commit is contained in:
parent
a92939b766
commit
40daefd3dc
Notes:
sideshowbarker
2024-07-19 12:24:56 +09:00
Author: https://github.com/deoxxa Commit: https://github.com/SerenityOS/serenity/commit/40daefd3dc5 Pull-request: https://github.com/SerenityOS/serenity/pull/511
1 changed files with 3 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue