<feed xmlns='http://www.w3.org/2005/Atom'>
<title>musl/src/stdio, branch v1.2.1</title>
<subtitle>musl - an implementation of the standard library for Linux-based systems</subtitle>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/'/>
<entry>
<title>vfscanf: fix possible invalid free due to uninitialized variable use</title>
<updated>2020-07-02T15:25:44+00:00</updated>
<author>
<name>Julien Ramseier</name>
<email>j.ramseier@gmail.com</email>
</author>
<published>2020-07-01T13:12:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=a62df9c9b7cad47e62b293abeddaf3fcdf09d8ae'/>
<id>a62df9c9b7cad47e62b293abeddaf3fcdf09d8ae</id>
<content type='text'>
vfscanf() may use the variable 'alloc' uninitialized when taking the
branch introduced by commit b287cd745c2243f8e5114331763a5a9813b5f6ee.
Spotted by clang.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
vfscanf() may use the variable 'alloc' uninitialized when taking the
branch introduced by commit b287cd745c2243f8e5114331763a5a9813b5f6ee.
Spotted by clang.
</pre>
</div>
</content>
</entry>
<entry>
<title>move __string_read into vsscanf source file</title>
<updated>2020-04-17T20:18:07+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2020-04-17T20:18:07+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=2e0907ce624e2058bb31fab5ae565f413dbaf87f'/>
<id>2e0907ce624e2058bb31fab5ae565f413dbaf87f</id>
<content type='text'>
apparently this function was intended at some point to be used by
strto* family as well, and thus was put in its own file; however, as
far as I can tell, it's only ever been used by vsscanf. move it to the
same file to reduce the number of source files and external symbols.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
apparently this function was intended at some point to be used by
strto* family as well, and thus was put in its own file; however, as
far as I can tell, it's only ever been used by vsscanf. move it to the
same file to reduce the number of source files and external symbols.
</pre>
</div>
</content>
</entry>
<entry>
<title>remove spurious repeated semicolon in fmemopen</title>
<updated>2020-04-17T20:11:43+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2020-04-17T20:11:43+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=2acf3bce0130fc58f79110f600825e268ca5a608'/>
<id>2acf3bce0130fc58f79110f600825e268ca5a608</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>combine two calls to memset in fmemopen</title>
<updated>2020-04-17T20:10:28+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2020-04-17T20:10:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=74fa4aac12d0d5a04ed411f2b3240f235a4475a1'/>
<id>74fa4aac12d0d5a04ed411f2b3240f235a4475a1</id>
<content type='text'>
this idea came up when I thought we might need to zero the UNGET
portion of buf as well, but it seems like a useful improvement even
when that turned out not to be necessary.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
this idea came up when I thought we might need to zero the UNGET
portion of buf as well, but it seems like a useful improvement even
when that turned out not to be necessary.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix undefined behavior in scanf core</title>
<updated>2020-04-17T19:19:05+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2020-04-17T17:46:57+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=b287cd745c2243f8e5114331763a5a9813b5f6ee'/>
<id>b287cd745c2243f8e5114331763a5a9813b5f6ee</id>
<content type='text'>
as reported/analyzed by Pascal Cuoq, the shlim and shcnt
macros/functions are called by the scanf core (vfscanf) with f-&gt;rpos
potentially null (if the FILE is not yet activated for reading at the
time of the call). in this case, they compute differences between a
null pointer (f-&gt;rpos) and a non-null one (f-&gt;buf), resulting in
undefined behavior.

it's unlikely that any observably wrong behavior occurred in practice,
at least without LTO, due to limits on what's visible to the compiler
from translation unit boundaries, but this has not been checked.

fix is simply ensuring that the FILE is activated for read mode before
entering the main scanf loop, and erroring out early if it can't be.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
as reported/analyzed by Pascal Cuoq, the shlim and shcnt
macros/functions are called by the scanf core (vfscanf) with f-&gt;rpos
potentially null (if the FILE is not yet activated for reading at the
time of the call). in this case, they compute differences between a
null pointer (f-&gt;rpos) and a non-null one (f-&gt;buf), resulting in
undefined behavior.

it's unlikely that any observably wrong behavior occurred in practice,
at least without LTO, due to limits on what's visible to the compiler
from translation unit boundaries, but this has not been checked.

fix is simply ensuring that the FILE is activated for read mode before
entering the main scanf loop, and erroring out early if it can't be.
</pre>
</div>
</content>
</entry>
<entry>
<title>remove wrap_write helper from vdprintf</title>
<updated>2020-02-22T04:44:20+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2020-02-22T04:44:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=a01f1fe66f44ffdbe2f15c2b2e850c2708f6ae5d'/>
<id>a01f1fe66f44ffdbe2f15c2b2e850c2708f6ae5d</id>
<content type='text'>
this reverts commit 4ee039f3545976f9e3e25a7e5d7b58f1f2316dc3, which
added the helper as a hack to make vdprintf usable before relocation,
contingent on strong assumptions about the arch and tooling, back when
the dynamic linker did not have a real staged model for
self-relocation. since commit f3ddd173806fd5c60b3f034528ca24542aecc5b9
this has been unnecessary and the function was just wasting size and
execution time.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
this reverts commit 4ee039f3545976f9e3e25a7e5d7b58f1f2316dc3, which
added the helper as a hack to make vdprintf usable before relocation,
contingent on strong assumptions about the arch and tooling, back when
the dynamic linker did not have a real staged model for
self-relocation. since commit f3ddd173806fd5c60b3f034528ca24542aecc5b9
this has been unnecessary and the function was just wasting size and
execution time.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix remaining direct use of stat syscalls outside fstatat.c</title>
<updated>2020-02-12T22:34:17+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2020-02-12T22:23:29+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=c9ebff4736128186121424364c1c62224b02aee3'/>
<id>c9ebff4736128186121424364c1c62224b02aee3</id>
<content type='text'>
because struct stat is no longer assumed to correspond to the
structure used by the stat-family syscalls, it's not valid to make any
of these syscalls directly using a buffer of type struct stat.

commit 9493892021eac4edf1776d945bcdd3f7a96f6978 moved all logic around
this change for stat-family functions into fstatat.c, making the
others wrappers for it. but a few other direct uses of the syscall
were overlooked. the ones in tmpnam/tempnam are harmless since the
syscalls are just used to test for file existence. however, the uses
in fchmodat and __map_file depend on getting accurate file properties,
and these functions may actually have been broken one or more mips
variants due to removal of conversion hacks from syscall_arch.h.

as a low-risk fix, simply use struct kstat in place of struct stat in
the affected places.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
because struct stat is no longer assumed to correspond to the
structure used by the stat-family syscalls, it's not valid to make any
of these syscalls directly using a buffer of type struct stat.

commit 9493892021eac4edf1776d945bcdd3f7a96f6978 moved all logic around
this change for stat-family functions into fstatat.c, making the
others wrappers for it. but a few other direct uses of the syscall
were overlooked. the ones in tmpnam/tempnam are harmless since the
syscalls are just used to test for file existence. however, the uses
in fchmodat and __map_file depend on getting accurate file properties,
and these functions may actually have been broken one or more mips
variants due to removal of conversion hacks from syscall_arch.h.

as a low-risk fix, simply use struct kstat in place of struct stat in
the affected places.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix return value of ungetc when argument is outside unsigned char range</title>
<updated>2019-10-19T01:11:44+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2019-10-19T01:11:44+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=f6ecd0c296181bf6a2a7f54e3406c846500e8e63'/>
<id>f6ecd0c296181bf6a2a7f54e3406c846500e8e63</id>
<content type='text'>
aside from the special value EOF, ungetc is specified to accept and
convert values outside the range of unsigned char. conversion takes
place automatically as part of assignment when storing into the
buffer, but the return value is also required to be the resulting
converted value, and this requirement was not satisfied.

simplified from patch by Wang Jianjian.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
aside from the special value EOF, ungetc is specified to accept and
convert values outside the range of unsigned char. conversion takes
place automatically as part of assignment when storing into the
buffer, but the return value is also required to be the resulting
converted value, and this requirement was not satisfied.

simplified from patch by Wang Jianjian.
</pre>
</div>
</content>
</entry>
<entry>
<title>fix %lf in wprintf</title>
<updated>2019-09-13T18:05:06+00:00</updated>
<author>
<name>Brion Vibber</name>
<email>brion@pobox.com</email>
</author>
<published>2019-09-12T05:43:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=f7e464bff4e4a9707a0e9471b1e039363059c8d4'/>
<id>f7e464bff4e4a9707a0e9471b1e039363059c8d4</id>
<content type='text'>
commit cc3a4466605fe8dfc31f3b75779110ac93055bc1 fixed this for printf
but neglected to fix wprintf.

Previously, %lf caused a failure to output.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit cc3a4466605fe8dfc31f3b75779110ac93055bc1 fixed this for printf
but neglected to fix wprintf.

Previously, %lf caused a failure to output.
</pre>
</div>
</content>
</entry>
<entry>
<title>use namespace-safe __lseek for __stdio_seek instead of direct syscall</title>
<updated>2019-07-16T22:31:33+00:00</updated>
<author>
<name>Rich Felker</name>
<email>dalias@aerifal.cx</email>
</author>
<published>2019-07-16T22:31:33+00:00</published>
<link rel='alternate' type='text/html' href='http://git.musl-libc.org/cgit/musl/commit/?id=03919b26ed41c31876db41f7cee076ced4513fad'/>
<id>03919b26ed41c31876db41f7cee076ced4513fad</id>
<content type='text'>
this probably saves a few bytes, avoids duplicating the clunky
lseek/_llseek syscall convention in two places, and sets the stage for
fixing broken seeks on x32 and mipsn32.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
this probably saves a few bytes, avoids duplicating the clunky
lseek/_llseek syscall convention in two places, and sets the stage for
fixing broken seeks on x32 and mipsn32.
</pre>
</div>
</content>
</entry>
</feed>
