FIX printf: '%0(invalid)' as-is (don't exclude '%')

This commit is contained in:
2025-07-24 20:32:49 +02:00
parent 89b50c83ba
commit 7c46988508

View File

@@ -222,6 +222,7 @@ printf:
je .wrapup
cmp byte [rdi + 1], '%'
je .rep_pct
xor r12, r12
; Include specifier (r13 bit0=1) or not (bit0=0)
xor r13, r13
cmp byte [rdi + 1], '#'
@@ -230,15 +231,13 @@ printf:
bts r13, 0
; Padding: zeroes (r13i bit1=1) or spaces (bit1=0)
.argGetPadZeroes:
mov r12, 1
cmp byte [rdi + 1], '0'
jb .noPadding
jb .checkReplArg
ja .padSpaces
bts r13, 1
.padSpaces:
cmp byte [rdi + 1], '9'
jg .noPadding
xor r12, r12
jg .checkReplArg
xor rcx, rcx
inc rdi
.findPaddingNumLen:
@@ -271,7 +270,10 @@ printf:
loop .getPaddingLoop
pop rax
pop rdi
.noPadding:
test r12, r12
jnz .checkReplArg
dec rdi
.checkReplArg:
cmp byte [rdi + 1], 'c'
je .rep_c
cmp byte [rdi + 1], 'i'