From: Corinna Vinschen <vinschen@redhat.com>
To: Takashi Yano <takashi.yano@nifty.ne.jp>
Cc: newlib@sourceware.org
Subject: Re: Coverity Scan: Analysis completed for RTEMS-Newlib
Date: Wed, 15 Nov 2023 14:50:45 +0100 [thread overview]
Message-ID: <ZVTMtYMriIPIHuMA@calimero.vinschen.de> (raw)
In-Reply-To: <20231111005930.0e9c21b8ff70b2160413e7a5@nifty.ne.jp>
On Nov 11 00:59, Takashi Yano wrote:
> On Sat, 11 Nov 2023 00:55:15 +0900
> Takashi Yano wrote:
> > 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.
>
> Ah, this problem will also occur for sprintf() family. So it seems that
> (1) is easier becase f._file = -1 is set at 41 places.
I wonder, though, if setting f._flags2 = 0 isn't all around the better
solution. That would mean that ORIENT itself doesn't have to become
more complicated, having to check (ori > 0) even in places, where this
isn't a problem.
Corinna
next prev parent reply other threads:[~2023-11-15 13:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <654dcb688da84_69bd52d4ed1e699a037313@prd-scan-dashboard-0.mail>
2023-11-10 14:50 ` Fwd: " Joel Sherrill
2023-11-10 15:31 ` Corinna Vinschen
2023-11-10 15:55 ` Takashi Yano
2023-11-10 15:59 ` Takashi Yano
2023-11-15 13:50 ` Corinna Vinschen [this message]
2023-11-10 17:44 ` Joel Sherrill
2023-11-13 13:19 ` Corinna Vinschen
2023-11-13 14:23 ` Joel Sherrill
2023-11-13 16:21 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZVTMtYMriIPIHuMA@calimero.vinschen.de \
--to=vinschen@redhat.com \
--cc=newlib@sourceware.org \
--cc=takashi.yano@nifty.ne.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).