diff options
author | Takashi Yano <takashi.yano@nifty.ne.jp> | 2023-11-10 19:09:47 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2023-11-20 22:59:12 +0300 |
commit | bc986b7ff668aa98372fc4e885307339e7ab3f51 (patch) | |
tree | 4a8b16525b74690bafcebe896c427c3ae94a025f /newlib/libc/stdio/vsnprintf.c | |
parent | d36b4f3f069881b2613b2754d6492d596c9e6ab9 (diff) |
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/vsnprintf.c')
-rw-r--r-- | newlib/libc/stdio/vsnprintf.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/newlib/libc/stdio/vsnprintf.c b/newlib/libc/stdio/vsnprintf.c index ecf82eaef..d9c72b526 100644 --- a/newlib/libc/stdio/vsnprintf.c +++ b/newlib/libc/stdio/vsnprintf.c @@ -64,6 +64,7 @@ _vsnprintf_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 : 0); f._file = -1; /* No file. */ |