public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jerry DeLisle <jvdelisle@charter.net>
To: Tobias Burnus <burnus@net-b.de>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	fortran <fortran@gcc.gnu.org>, Harald Anlauf <anlauf@gmx.de>
Subject: Re: [Patch] Fortran: Fix 'name' bound size [PR99688]
Date: Sun, 21 Mar 2021 17:25:56 -0700	[thread overview]
Message-ID: <9879f6b4-4235-38a0-b74e-e1111dc6b82d@charter.net> (raw)
In-Reply-To: <a0b37568-f8fa-bee7-6489-1e171d95a942@net-b.de>

Hi Tobias and others,

Reembering some of my own history, we always have used a +1 on 
'LENGTH_MAX' items to allow the C null termination on strings or buffers 
for obvious reasons.

Certainly OK for trunk and backports.

Regards,

Jerry

On 3/21/21 9:08 AM, Tobias Burnus wrote:
> The gfc_match_select_rank issue showed up in the testsuite
> and was found by Martin's asan-bootstrapped GCC. First
> analysis by Harald – thanks to both!
>
> However, I think the other variables I fixed were also
> prone to overflows; see below for its usage.
>
> OK for mainline? Other branches?
>
> Tobias
>
> PS: Other pending Fortran patches – please review!
> [Patch] Fortran: Fix intrinsic null() handling [PR99651]
> [Patch] Fortran: Fix func decl mismatch [PR93660]
>
> PPS: Usage of 'name' in the patched functions:
>
> resolve_select_type (gfc_code *code, gfc_namespace *old_ns)
>   char name[GFC_MAX_SYMBOL_LEN];
> ...
>         sprintf (name, "__tmp_class_%s", c->ts.u.derived->name);
>
>
> select_intrinsic_set_tmp (gfc_typespec *ts)
> {
>   char name[GFC_MAX_SYMBOL_LEN];
> ...
>         sprintf (name, "__tmp_class_%s", ts->u.derived->name);
>
>
> gfc_match_select_type (void)
> ...
>   char name[GFC_MAX_SYMBOL_LEN];
> ...
>   m = gfc_match (" %n => %e", name, &expr2);
>
> gfc_match_select_rank (void)
> ...
>   char name[GFC_MAX_SYMBOL_LEN];
> ...
>   m = gfc_match (" %n => %e", name, &expr2);
>


      reply	other threads:[~2021-03-22  0:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-21 16:08 Tobias Burnus
2021-03-22  0:25 ` Jerry DeLisle [this message]

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=9879f6b4-4235-38a0-b74e-e1111dc6b82d@charter.net \
    --to=jvdelisle@charter.net \
    --cc=anlauf@gmx.de \
    --cc=burnus@net-b.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@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: 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).