From 6cfb1b6f5f07773baba1639aebfacec622f99a6a Mon Sep 17 00:00:00 2001 From: Kwarde Date: Thu, 24 Jul 2025 22:20:47 +0200 Subject: [PATCH] printf fix: Decrease rdi if padding is not 0 and specifier is invalid (assure '%' is printed) --- src/console.asm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/console.asm b/src/console.asm index 516591a..111b9fb 100644 --- a/src/console.asm +++ b/src/console.asm @@ -297,6 +297,10 @@ printf: ;--- Invalid ---; .invalidReplacement: + test r12, r12 + jz .irNoPadding + dec rdi + .irNoPadding: cmp byte [rdi + 1], '\' je .invalidReplacement_specialChar; '%\n' would become "'%','\','n'" instead of "'%',EOS" when inserting full invalid specifier. mov r9w, word [rdi]