[PATCH] [BZ #15381] Initialize wide struct info.
Carlos O'Donell
carlos@redhat.com
Fri May 3 02:15:00 GMT 2013
On 05/02/2013 01:32 PM, OndÅej BÃlka wrote:
> Hi,
> For byte-oriented streams a wide data field takes undefined value.
> This patch initializes it to NULL for more deterministic behaviour.
>
> OK for 2.18?
>
> * libio/genops.c (_IO_no_init): Initialize wide struct info.
>
> ---
> libio/genops.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/libio/genops.c b/libio/genops.c
> index 390d8d2..18039aa 100644
> --- a/libio/genops.c
> +++ b/libio/genops.c
> @@ -643,6 +643,7 @@ _IO_no_init (fp, flags, orientation, wd, jmp)
> {
> _IO_old_init (fp, flags);
> fp->_mode = orientation;
> + fp->_wide_data = NULL;
> #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
> if (orientation >= 0)
> {
>
Is fp->_wide_data ever used uninitialized?
Note:
libio/iofopen.c has:
83 _IO_no_init (&new_f->fp.file, 1, 0, NULL, NULL);
Which would crash at runtime if it was ever used.
It looks like the conditional that enables this code
is probably never true e.g.
!(defined _LIBC || defined _GLIBCPP_USE_WCHAR_T)
Cheers,
Carlos.
More information about the Libc-alpha
mailing list