Coverity Scan: Analysis completed for RTEMS-Newlib
Takashi Yano
takashi.yano@nifty.ne.jp
Fri Nov 10 15:55:15 GMT 2023
On Fri, 10 Nov 2023 16:31:44 +0100
Corinna Vinschen wrote:
> On Nov 10 08:50, Joel Sherrill wrote:
> > Hmmmm.. an email just before the one I forwarded shows 6 new defects were
> > added in the last commits. They appear to be the same issue I just
> > forwarded but in different scanf variants.
> >
> > CID 423229 (#1 of 1): Uninitialized scalar variable (UNINIT)2.
> > uninit_use_in_call: Using uninitialized value f._flags2 when calling
> > __ssvfiscanf_r. [show details
> > <https://scan3.scan.coverity.com/eventId=13202494-1&modelId=13202494-0&fileInstanceId=104130545&filePath=%2Fhome%2Fjoel%2Frtems-cron-coverity%2Fsourceware-mirror-newlib-cygwin%2Fnewlib%2Flibc%2Fstdio%2Fvfscanf.c&fileStart=400&fileEnd=1980>
> > ]
>
> Looks like a false positive.
>
> The ORIENT macro will set or reset the value of the _flags2 __SWID bit
> if the _flags __SORD bit isn't set. It never is set at the start, so
> the _flags2 __SWID bit is always set. And only then, the ORIENT macro
> will check the value.
Perhaps, this happens because other bits of _flags2 than __SWID is not
initialized.
Which is better solution do you think?
(1) Modify ORIENT macro so that it returns (ori > 0) ? 1 : -1.
(2) Initialize f._flags2 = 0 in sscanf() family.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
More information about the Newlib
mailing list