Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 14 Dec 2021 10:22:42 -0500
From: Andrew Snyder <arsnyder16@...il.com>
To: musl@...ts.openwall.com
Subject: print does not support variable width plus padding

I would like to be cc'd on the replies

Looks like a bug in the musl printf functionality

When using variable width format string and specifying a padding musl fails
to format properly.

I am using musl indirectly through an emscripten compile of a native
library.

Consider the following repro steps using alpine docker image. Correct
results exist when using ubuntu image

# Correct expected  ' 1'
docker run -it --rm alpine printf %2i 1
# Correct expected  ' 1'
docker run -it --rm alpine printf %*i 2 1
# Correct expected  '01'
docker run -it --rm alpine printf %02i 1
# errors, Expected '01'
docker run -it --rm alpine printf %0*i 2 1

# Correct expected  ' 1'
docker run -it --rm ubuntu printf %2i 1
# Correct expected  ' 1'
docker run -it --rm ubuntu printf %*i 2 1
# Correct expected  '01'
docker run -it --rm ubuntu printf %02i 1
# Correct expected  '01'
docker run -it --rm ubuntu printf %0*i 2 1

--Andrew

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.