From: Nick Clifton <nickc@redhat.com>
To: gdb-patches@sourceware.org
Subject: Commit: AArch64 sim: Fix off by one error checking for invalid vector array element
Date: Fri, 18 Mar 2016 14:44:00 -0000 [thread overview]
Message-ID: <87fuvnu9q7.fsf@redhat.com> (raw)
Hi Guys,
I am checking in the patch below to fix an off-by-one error pointed
out by Mike Frysinger in my previous delta to the AArch64 simulator's
vector register get and set functions.
Cheers
Nick
sim/aarch64/ChangeLog
2016-03-18 Nick Clifton <nickc@redhat.com>
* cpustate.c (GET_VEC_ELEMENT): Fix off by one error checking
for an invalid element index.
(SET_VEC_ELEMENT): Likewise.
diff --git a/sim/aarch64/cpustate.c b/sim/aarch64/cpustate.c
index 86b1b15..19f485e 100644
--- a/sim/aarch64/cpustate.c
+++ b/sim/aarch64/cpustate.c
@@ -345,7 +345,7 @@ aarch64_set_FP_long_double (sim_cpu *cpu, VReg reg, FRegister a)
#define GET_VEC_ELEMENT(REG, ELEMENT, FIELD) \
do \
{ \
- if (element > ARRAY_SIZE (cpu->fr[0].FIELD)) \
+ if (element >= ARRAY_SIZE (cpu->fr[0].FIELD)) \
{ \
TRACE_REGISTER (cpu, \
"Internal SIM error: invalid element number: %d ",\
@@ -421,7 +421,7 @@ aarch64_get_vec_double (sim_cpu *cpu, VReg reg, unsigned element)
#define SET_VEC_ELEMENT(REG, ELEMENT, VAL, FIELD, PRINTER) \
do \
{ \
- if (ELEMENT > ARRAY_SIZE (cpu->fr[0].FIELD)) \
+ if (ELEMENT >= ARRAY_SIZE (cpu->fr[0].FIELD)) \
{ \
TRACE_REGISTER (cpu, \
"Internal SIM error: invalid element number: %d ",\
next reply other threads:[~2016-03-18 14:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-18 14:44 Nick Clifton [this message]
2016-03-18 14:54 ` Andreas Schwab
2016-03-18 17:10 ` Nick Clifton
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=87fuvnu9q7.fsf@redhat.com \
--to=nickc@redhat.com \
--cc=gdb-patches@sourceware.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