* [Qemu-devel] [PATCH] target-arm: Fix potential buffer overflow
@ 2012-09-04 5:35 Stefan Weil
2012-09-04 14:19 ` Peter Maydell
2012-09-10 13:17 ` Aurelien Jarno
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2012-09-04 5:35 UTC (permalink / raw)
To: Paul Brook, Peter Maydell; +Cc: Stefan Weil, qemu-devel
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 <sw@weilnetz.de>
---
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;
--
1.7.10
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: Fix potential buffer overflow
2012-09-04 5:35 [Qemu-devel] [PATCH] target-arm: Fix potential buffer overflow Stefan Weil
@ 2012-09-04 14:19 ` Peter Maydell
2012-09-10 13:17 ` Aurelien Jarno
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2012-09-04 14:19 UTC (permalink / raw)
To: Stefan Weil; +Cc: Paul Brook, qemu-devel
On 4 September 2012 06:35, Stefan Weil <sw@weilnetz.de> 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 <sw@weilnetz.de>
Nice catch, dumb bug I introduced in the conversion to
CPRegInfo in commit 06d76f319f.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] target-arm: Fix potential buffer overflow
2012-09-04 5:35 [Qemu-devel] [PATCH] target-arm: Fix potential buffer overflow Stefan Weil
2012-09-04 14:19 ` Peter Maydell
@ 2012-09-10 13:17 ` Aurelien Jarno
1 sibling, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2012-09-10 13:17 UTC (permalink / raw)
To: Stefan Weil; +Cc: Peter Maydell, Paul Brook, qemu-devel
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 <sw@weilnetz.de>
> ---
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-10 13:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-04 5:35 [Qemu-devel] [PATCH] target-arm: Fix potential buffer overflow Stefan Weil
2012-09-04 14:19 ` Peter Maydell
2012-09-10 13:17 ` Aurelien Jarno
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.