newlib-cygwin/newlib/libc/stdio
Takashi Yano bc986b7ff6 stdio: Fix bugs in commit 3d94e07c49
The commit 3d94e07c49 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: 3d94e07c49 ("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>
2023-11-20 20:59:12 +01:00
..
Makefile.inc v{fs}printf/v{fs}wprintf: create external output helpers 2023-11-17 13:10:20 +01:00
asiprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
asniprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
asnprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
asprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
clearerr.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
clearerr_u.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
diprintf.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
dprintf.c ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
fclose.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fcloseall.c Use global stdio streams for all configurations 2022-06-10 20:13:52 +02:00
fdopen.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
feof.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
feof_u.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
ferror.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
ferror_u.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
fflush.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
fflush_u.c Implement BSD/GNU unlocked stdio extensions. 2014-12-18 14:55:21 +00:00
fgetc.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fgetc_u.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
fgetpos.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fgets.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fgets_u.c Implement BSD/GNU unlocked stdio extensions. 2014-12-18 14:55:21 +00:00
fgetwc.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
fgetwc_u.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
fgetws.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
fgetws_u.c Implement BSD/GNU unlocked stdio extensions. 2014-12-18 14:55:21 +00:00
fileno.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
fileno_u.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
findfp.c Restore _lock initialization in non-single threaded mode 2022-08-31 10:02:53 +02:00
fiprintf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fiscanf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
flags.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
floatio.h Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fmemopen.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
fopen.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fopencookie.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
fprintf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fpurge.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
fputc.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fputc_u.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
fputs.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
fputs_u.c Implement BSD/GNU unlocked stdio extensions. 2014-12-18 14:55:21 +00:00
fputwc.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
fputwc_u.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
fputws.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
fputws_u.c Implement BSD/GNU unlocked stdio extensions. 2014-12-18 14:55:21 +00:00
fread.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
fread_u.c Implement BSD/GNU unlocked stdio extensions. 2014-12-18 14:55:21 +00:00
freopen.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
fscanf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fseek.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fseeko.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
fsetlocking.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
fsetpos.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
ftell.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
ftello.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
funopen.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
fvwrite.c __sfvwrite_r: call __sputc_r rather than putc in __SCLE case 2023-11-17 17:09:42 +01:00
fvwrite.h Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fwalk.c stdio: Replace _fwalk_reent() with _fwalk_sglue() 2022-05-13 12:40:10 +02:00
fwide.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
fwprintf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
fwrite.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
fwrite_u.c Implement BSD/GNU unlocked stdio extensions. 2014-12-18 14:55:21 +00:00
fwscanf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
getc.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
getc_u.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
getchar.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
getchar_u.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
getdelim.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
getline.c ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
gets.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
getw.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
getwc.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
getwc_u.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
getwchar.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
getwchar_u.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
iprintf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
iscanf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
local.h newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
makebuf.c Fix bug introduced in previous patch (44b60f0c) 2022-04-01 15:42:32 +02:00
mktemp.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
nano-svfprintf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
nano-svfscanf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
nano-vfprintf.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
nano-vfprintf_float.c nano-vfprintf_float.c: Fix check if negative for nans. 2018-12-13 13:15:32 +01:00
nano-vfprintf_i.c ansification: remove _CONST 2018-01-17 11:47:08 -06:00
nano-vfprintf_local.h ansification: remove _PTR 2018-01-17 11:47:16 -06:00
nano-vfscanf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
nano-vfscanf_float.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
nano-vfscanf_i.c ansification: remove _PARAMS 2018-01-17 11:47:13 -06:00
nano-vfscanf_local.h Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
open_memstream.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
perror.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
printf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
putc.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
putc_u.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
putchar.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
putchar_u.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
puts.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
putw.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
putwc.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
putwc_u.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
putwchar.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
putwchar_u.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
refill.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
remove.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
rename.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
rewind.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
rget.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
scanf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
sccl.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
setbuf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
setbuffer.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
setlinebuf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
setvbuf.c Add _REENT_CLEANUP(ptr) 2022-07-13 06:55:46 +02:00
sfputs_r.c v{fs}printf/v{fs}wprintf: create external output helpers 2023-11-17 13:10:20 +01:00
sfputws_r.c v{fs}printf/v{fs}wprintf: create external output helpers 2023-11-17 13:10:20 +01:00
siprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
siscanf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
sniprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
snprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
sprint_r.c v{fs}printf/v{fs}wprintf: create external output helpers 2023-11-17 13:10:20 +01:00
sprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
sscanf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
ssprint_r.c v{fs}printf/v{fs}wprintf: create external output helpers 2023-11-17 13:10:20 +01:00
ssputs_r.c v{fs}printf/v{fs}wprintf: create external output helpers 2023-11-17 13:10:20 +01:00
ssputws_r.c v{fs}printf/v{fs}wprintf: create external output helpers 2023-11-17 13:10:20 +01:00
sswprint_r.c v{fs}printf/v{fs}wprintf: create external output helpers 2023-11-17 13:10:20 +01:00
stdio.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
stdio.tex Fix makedoc markup used in texinfo source 2015-06-23 16:14:39 +01:00
stdio_ext.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
svfiprintf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
svfiscanf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
svfiwprintf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
svfiwscanf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
svfprintf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
svfscanf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
svfwprintf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
svfwscanf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
swprint_r.c v{fs}printf/v{fs}wprintf: create external output helpers 2023-11-17 13:10:20 +01:00
swprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
swscanf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
tmpfile.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00
tmpnam.c Fix _REENT_EMERGENCY() if TLS is enabled 2023-04-26 08:23:04 +02:00
ungetc.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
ungetwc.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
vasiprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
vasniprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
vasnprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
vasprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
vdiprintf.c ansification: remove _DEFUN 2018-01-17 11:47:26 -06:00
vdprintf.c ansification: remove _EXFUN, _EXFUN_NOTHROW 2018-01-17 11:47:29 -06:00
vfieeefp.h Add __packed to struct ldieee 2017-04-18 12:25:35 +02:00
vfiprintf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
vfiscanf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
vfiwprintf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
vfiwscanf.c newlib: libc: move stdio multiplex logic from build to source files 2022-02-28 19:04:11 -05:00
vfprintf.c v{fs}printf/v{fs}wprintf: create external output helpers 2023-11-17 13:10:20 +01:00
vfscanf.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
vfwprintf.c v{fs}printf/v{fs}wprintf: create external output helpers 2023-11-17 13:10:20 +01:00
vfwscanf.c newlib: libc: Fix crash on fprintf to a wide-oriented stream. 2023-11-10 00:36:41 +09:00
viprintf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
viscanf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
vprintf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
vscanf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
vsiprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
vsiscanf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
vsniprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
vsnprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
vsprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
vsscanf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
vswprintf.c stdio: Fix bugs in commit 3d94e07c49 2023-11-20 20:59:12 +01:00
vswscanf.c Fix some Coverity Scan errors. 2022-08-31 15:18:08 -04:00
vwprintf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
vwscanf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
wbuf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
wprintf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
wscanf.c Use remove-advertising-clause script to edit BSD licenses 2020-01-29 19:03:31 +01:00
wsetup.c Add _REENT_ERRNO(ptr) 2022-07-13 06:55:41 +02:00