[PATCH v4] newlib: libc: Fix crash on fprintf to a wide-oriented stream.

Takashi Yano takashi.yano@nifty.ne.jp
Wed Nov 8 22:00:47 GMT 2023


On Wed, 8 Nov 2023 20:40:57 +0100
Corinna Vinschen wrote:
> On Nov  8 21:04, Takashi Yano wrote:
> > --- a/newlib/libc/stdio/local.h
> > +++ b/newlib/libc/stdio/local.h
> > +#define ORIENT(fp,ori)			\
> > +  (					\
> > +    (					\
> > +      ((fp)->_flags & __SORD) ?		\
> > +	0				\
> > +      :					\
> > +	(				\
> 
> You're missing to set (fp)->_flags |= __SORD here.
> 
> > +	  (ori > 0) ?			\
> > +	    ((fp)->_flags2 |= __SWID)	\
> > +	  :				\
> > +	    ((fp)->_flags2 &= ~__SWID)	\
> > +	)				\
> > +    ),					\
> > +    (((fp)->_flags2 & __SWID) ? 1 : -1)	\
> > +  )

Argh! Thanks.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>


More information about the Newlib mailing list