diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2023-11-11 01:09:47 +0900 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2023-11-20 20:59:12 +0100 |
commit | bc986b7ff668aa98372fc4e885307339e7ab3f51 (patch) | |
tree | 4a8b16525b74690bafcebe896c427c3ae94a025f /newlib/libc/stdio/vswprintf.c | |
parent | d36b4f3f069881b2613b2754d6492d596c9e6ab9 (diff) | |
download | newlib-bc986b7ff668aa98372fc4e885307339e7ab3f51.zip newlib-bc986b7ff668aa98372fc4e885307339e7ab3f51.tar.gz newlib-bc986b7ff668aa98372fc4e885307339e7ab3f51.tar.bz2 |
stdio: Fix bugs in commit 3d94e07c49b5
The commit 3d94e07c49b5 has a few bugs which cause testsuite failure
in libstdc++. This is due to excess orientation check in __srefill_r()
and _ungetc_r(). Further, sscanf() family also calls ssvfscanf() family
with fp->_file == -1. This causes undesired orientation set/check for
sscanf() family. This patch fixes these problems.
Also, as in GLibC, do not set orientation in ungetc, and only set, but
do not check orientation in ungetwc.
Fixes: 3d94e07c49b5 ("newlib: libc: Fix crash on fprintf to a wide-oriented stream.")
Reported-by: Christophe Lyon <christophe.lyon@linaro.org>
Reported-by: Joel Sherrill <joel@rtems.org>
Co-developed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc/stdio/vswprintf.c')
-rw-r--r-- | newlib/libc/stdio/vswprintf.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/newlib/libc/stdio/vswprintf.c b/newlib/libc/stdio/vswprintf.c index 08a8545..ab2e52f 100644 --- a/newlib/libc/stdio/vswprintf.c +++ b/newlib/libc/stdio/vswprintf.c @@ -46,6 +46,7 @@ _vswprintf_r (struct _reent *ptr, return EOF; } f._flags = __SWR | __SSTR; + f._flags2 = 0; f._bf._base = f._p = (unsigned char *) str; f._bf._size = f._w = (size > 0 ? (size - 1) * sizeof (wchar_t) : 0); f._file = -1; /* No file. */ |