public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2205] [Ada] Fix index range violations in krunch Date: Fri, 9 Jul 2021 12:38:58 +0000 (GMT) [thread overview] Message-ID: <20210709123858.93631398B0F0@sourceware.org> (raw) https://gcc.gnu.org/g:90635a37c2d0e0468c3599398c5f8eeecf596f93 commit r12-2205-g90635a37c2d0e0468c3599398c5f8eeecf596f93 Author: Fedor Rybin <frybin@adacore.com> Date: Fri Jun 4 21:01:27 2021 +0300 [Ada] Fix index range violations in krunch gcc/ada/ * krunch.adb: Add safeguards against index range violations. Diff: --- gcc/ada/krunch.adb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gcc/ada/krunch.adb b/gcc/ada/krunch.adb index 4cff3ca13ab..f698d889c22 100644 --- a/gcc/ada/krunch.adb +++ b/gcc/ada/krunch.adb @@ -92,15 +92,16 @@ begin Startloc := 3; Buffer (2 .. Len - 5) := Buffer (7 .. Len); Curlen := Len - 5; - if Buffer (Curlen - 2 .. Curlen) = "128" - or else Buffer (3 .. 9) = "exn_lll" - or else Buffer (3 .. 9) = "exp_lll" - or else Buffer (3 .. 9) = "img_lll" - or else Buffer (3 .. 9) = "val_lll" - or else Buffer (3 .. 9) = "wid_lll" - or else (Buffer (3 .. 6) = "pack" and then Curlen = 10) + if (Curlen >= 3 and then Buffer (Curlen - 2 .. Curlen) = "128") + or else (Len >= 9 and then + (Buffer (3 .. 9) = "exn_lll" + or else Buffer (3 .. 9) = "exp_lll" + or else Buffer (3 .. 9) = "img_lll" + or else Buffer (3 .. 9) = "val_lll" + or else Buffer (3 .. 9) = "wid_lll")) + or else (Curlen = 10 and then Buffer (3 .. 6) = "pack") then - if Buffer (3 .. 15) = "compare_array" then + if Len >= 15 and then Buffer (3 .. 15) = "compare_array" then Buffer (3 .. 4) := "ca"; Buffer (5 .. Curlen - 11) := Buffer (16 .. Curlen); Curlen := Curlen - 11;
reply other threads:[~2021-07-09 12:38 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210709123858.93631398B0F0@sourceware.org \ --to=pmderodat@gcc.gnu.org \ --cc=gcc-cvs@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).