[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions
From: |
Li Qiang |
Subject: |
Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions |
Date: |
Tue, 9 Apr 2019 08:18:29 +0800 |
Lidong Chen <address@hidden> 于2019年4月9日周二 上午3:51写道:
> Due to an off-by-one error, the assert statements allow an
> out-of-bounds array access.
>
> Signed-off-by: Lidong Chen <address@hidden>
>
Reviewed-by: Li Qiang <address@hidden>
> ---
> hw/sd/sd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index aaab15f..818f86c 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -144,7 +144,7 @@ static const char *sd_state_name(enum SDCardStates
> state)
> if (state == sd_inactive_state) {
> return "inactive";
> }
> - assert(state <= ARRAY_SIZE(state_name));
> + assert(state < ARRAY_SIZE(state_name));
> return state_name[state];
> }
>
> @@ -165,7 +165,7 @@ static const char *sd_response_name(sd_rsp_type_t rsp)
> if (rsp == sd_r1b) {
> rsp = sd_r1;
> }
> - assert(rsp <= ARRAY_SIZE(response_name));
> + assert(rsp < ARRAY_SIZE(response_name));
> return response_name[rsp];
> }
>
> --
> 1.8.3.1
>
>
>
- [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Lidong Chen, 2019/04/08
- Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Marc-André Lureau, 2019/04/08
- Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Philippe Mathieu-Daudé, 2019/04/08
- Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions,
Li Qiang <=
- Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Markus Armbruster, 2019/04/09
- Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Aleksandar Markovic, 2019/04/09
- Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Philippe Mathieu-Daudé, 2019/04/09
- Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Daniel P . Berrangé, 2019/04/11
- Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Markus Armbruster, 2019/04/11
- Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Daniel P . Berrangé, 2019/04/11
- Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Markus Armbruster, 2019/04/11
Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Aleksandar Markovic, 2019/04/09
Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Peter Maydell, 2019/04/09
Re: [Qemu-devel] [PATCH] sd: Fix out-of-bounds assertions, Liam Merwick, 2019/04/09