public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/54878] New: libgfortran issues found by the Coverity scanner Date: Tue, 09 Oct 2012 20:55:00 -0000 [thread overview] Message-ID: <bug-54878-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54878 Bug #: 54878 Summary: libgfortran issues found by the Coverity scanner Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org CC: jb@gcc.gnu.org, tkoenig@gcc.gnu.org Sister bug to the FE PR 54599. The coverity scanner found the following (potential) issues in libgfortran. a) io/unix.c: Before calling mkstemps, one should set the umask - otherwise, one might create a world-readable file in /tmp. As the Linux man page put it: The old behavior of creating a file with mode 0666 may be a security risk, especially since other UNIX flavors use 0600, and somebody might overlook this detail when porting programs. More generally, the POSIX specification of mkstemp() does not say anything about file modes, so the application should make sure its file mode creation mask (see umask(2)) is set appropriately before calling mkstemp() (and mkostemp()). b) io/unix.c: In fd_to_stream: Return value not checked for fstat (fd, &statbuf); c) io/unit.c's filename_from_unit At (17): Calling function "unpack_filename(char *, char const *, int)" without checking return value (as is done elsewhere 10 out of 12 times). At (18): No check of the return value of "unpack_filename(filename, u->file, u->file_len)". 784 unpack_filename (filename, u->file, u->file_len); 785 return filename; d) generated/iall_i1.c: Unreachable code: 220 len = GFC_DESCRIPTOR_EXTENT(array,dim); 221 if (len <= 0) 222 return; ... 326 if (len <= 0) 327 *dest = 0; e) runtime/bounds.c: index_type count_0 At (3): Comparing "base" to null implies that "base" might be null. 228 if (base) 229 base = GFOR_POINTER_TO_L1 (base, kind); ... CID 732652 (#1 of 1): Dereference after null check (FORWARD_NULL)At (10): Dereferencing null pointer "base". 248 if (*base) 249 result ++; f) io/list_read.c: Unreachable code in nml_query: 2432 p = write_block (dtp, endlen + 3); 2433 goto query_return; 2434 memcpy (p, &nmlend, endlen + 3); /* <<< UNREACHABLE */ Additionally/Hence: the result "p" is never used. g) io/intrinsics.c CID 732515 (#1 of 1): Unchecked return value (CHECKED_RETURN)At (3): Calling function "sseek(stream *, gfc_offset, int)" without checking return value (as is done elsewhere 21 out of 26 times). (Also not checked in io/file_pos.c's st_backspace.) 262 gf_ftell (int unit) ... 269 sseek (u->s, pos, SEEK_CUR); h) io/inquire.c: inquire_via_unit 47 *iqp->exist = (iqp->common.unit >= 0 48 && iqp->common.unit <= GFC_INTEGER_4_HUGE); The latter is ways true as common.unit is of type GFC_INTEGER_4. And some more.
next reply other threads:[~2012-10-09 20:55 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-10-09 20:55 burnus at gcc dot gnu.org [this message] 2012-10-10 18:42 ` [Bug fortran/54878] " burnus at gcc dot gnu.org 2014-12-21 12:37 ` dominiq at lps dot ens.fr 2021-12-16 18:23 ` [Bug libfortran/54878] " fxcoudert at gcc dot gnu.org
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=bug-54878-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).