[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [PATCH v5 18/24] ssd0323: fix buffer overun on invalid
From: |
Peter Maydell |
Subject: |
Re: [Qemu-stable] [PATCH v5 18/24] ssd0323: fix buffer overun on invalid state load |
Date: |
Thu, 3 Apr 2014 18:13:47 +0100 |
On 3 April 2014 17:52, Michael S. Tsirkin <address@hidden> wrote:
> CVE-2013-4538
>
> s->cmd_len used as index in ssd0323_transfer() to store 32-bit field.
> Possible this field might then be supplied by guest to overwrite a
> return addr somewhere. Same for row/col fields, which are indicies into
> framebuffer array.
>
> To fix validate after load.
>
> Additionally, validate that the row/col_start/end are within bounds;
> otherwise the guest can provoke an overrun by either setting the _end
> field so large that the row++ increments just walk off the end of the
> array, or by setting the _start value to something bogus and then
> letting the "we hit end of row" logic reset row to row_start.
>
> For completeness, validate mode as well.
>
> Signed-off-by: Michael S. Tsirkin <address@hidden>
> ---
> hw/display/ssd0323.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/hw/display/ssd0323.c b/hw/display/ssd0323.c
> index 971152e..d4b9ea3 100644
> --- a/hw/display/ssd0323.c
> +++ b/hw/display/ssd0323.c
> @@ -312,18 +312,42 @@ static int ssd0323_load(QEMUFile *f, void *opaque, int
> version_id)
> return -EINVAL;
>
> s->cmd_len = qemu_get_be32(f);
> + if (s->cmd_len < 0 || s->cmd_len > ARRAY_SIZE(s->cmd_data)) {
> + return -EINVAL;
> + }
> s->cmd = qemu_get_be32(f);
> for (i = 0; i < 8; i++)
> s->cmd_data[i] = qemu_get_be32(f);
> s->row = qemu_get_be32(f);
> + if (s->row < 0 || s->row >= 80 ) {
Spurious space before ')' (here and below).
Otherwise
Reviewed-by: Peter Maydell <address@hidden>
though
#define SSD0323_ROWS 128
#define SSD0323_ROWBYTES (SSD0323_ROWS / 2)
#define SSD0323_COLS 64
and using the symbolic constants here and elsewhere
in the device wouldn't be a bad idea at some point.
thanks
-- PMM
- [Qemu-stable] [PATCH v5 13/24] virtio: avoid buffer overrun on incoming migration, (continued)
- [Qemu-stable] [PATCH v5 13/24] virtio: avoid buffer overrun on incoming migration, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 14/24] openpic: avoid buffer overrun on incoming migration, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 16/24] pxa2xx: avoid buffer overrun on incoming migration, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 15/24] virtio: validate num_sg when mapping, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 17/24] ssi-sd: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 18/24] ssd0323: fix buffer overun on invalid state load, Michael S. Tsirkin, 2014/04/03
- Re: [Qemu-stable] [PATCH v5 18/24] ssd0323: fix buffer overun on invalid state load,
Peter Maydell <=
- [Qemu-stable] [PATCH v5 19/24] tsc210x: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 21/24] virtio-scsi: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 20/24] zaurus: fix buffer overrun on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 22/24] vmstate: s/VMSTATE_INT32_LE/VMSTATE_INT32_POSITIVE_LE/, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 06/24] virtio-net: out-of-bounds buffer write on invalid state load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 23/24] usb: sanity check setup_index+setup_len in post_load, Michael S. Tsirkin, 2014/04/03
- [Qemu-stable] [PATCH v5 24/24] savevm: Ignore minimum_version_id_old if there is no load_state_old, Michael S. Tsirkin, 2014/04/03