Received: from eggs.gnu.org ([208.118.235.92]:40751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB3s8-0003Tc-9O for qemu-devel@nongnu.org; Mon, 10 Sep 2012 09:18:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TB3s2-0000W2-7W for qemu-devel@nongnu.org; Mon, 10 Sep 2012 09:17:52 -0400 Received: from hall.aurel32.net ([88.191.126.93]:33469) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB3s2-0000Vq-1O for qemu-devel@nongnu.org; Mon, 10 Sep 2012 09:17:46 -0400 Date: Mon, 10 Sep 2012 15:17:41 +0200 From: Aurelien Jarno Message-ID: <20120910131741.GU6791@ohm.aurel32.net> References: <1346736957-24745-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1346736957-24745-1-git-send-email-sw@weilnetz.de> Subject: Re: [Qemu-devel] [PATCH] target-arm: Fix potential buffer overflow List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: Peter Maydell , Paul Brook , qemu-devel@nongnu.org On Tue, Sep 04, 2012 at 07:35:57AM +0200, Stefan Weil wrote: > Report from smatch: > > target-arm/helper.c:651 arm946_prbs_read(6) error: > buffer overflow 'env->cp15.c6_region' 8 <= 8 > target-arm/helper.c:661 arm946_prbs_write(6) error: > buffer overflow 'env->cp15.c6_region' 8 <= 8 > > c7_region is an array with 8 elements, so the index must be less than 8. > > Signed-off-by: Stefan Weil > --- > target-arm/helper.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/target-arm/helper.c b/target-arm/helper.c > index dceaa95..e27df96 100644 > --- a/target-arm/helper.c > +++ b/target-arm/helper.c > @@ -645,7 +645,7 @@ static int pmsav5_insn_ap_read(CPUARMState *env, const ARMCPRegInfo *ri, > static int arm946_prbs_read(CPUARMState *env, const ARMCPRegInfo *ri, > uint64_t *value) > { > - if (ri->crm > 8) { > + if (ri->crm >= 8) { > return EXCP_UDEF; > } > *value = env->cp15.c6_region[ri->crm]; > @@ -655,7 +655,7 @@ static int arm946_prbs_read(CPUARMState *env, const ARMCPRegInfo *ri, > static int arm946_prbs_write(CPUARMState *env, const ARMCPRegInfo *ri, > uint64_t value) > { > - if (ri->crm > 8) { > + if (ri->crm >= 8) { > return EXCP_UDEF; > } > env->cp15.c6_region[ri->crm] = value; Thanks, applied. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net