Skip to contentSkip to conversation

segfault in memcmp

Qemu-devel perrier vincent 3 participants 3 messages Jun 5, 2015 – Jun 8, 2015

lore
Share & tools
lore
#0 lore raw

Using a very old guest (lenny) with spice and vga=cirrus, I have a segfault:

FILE:      ui/spice-display.c
FUNCTION:  qemu_spice_create_update
LINE:      if (memcmp(guest + yoff + xoff,

mirror + yoff + xoff,
bw * bpp) == 0)

The address of mirror + yoff + xoff is out of boundaries.

I use the following to avoid the crash:

...
img_get_stride = pixman_image_get_stride(ssd->mirror); img_height = pixman_image_get_height(ssd->mirror); img_max = img_height * img_get_stride;
...
if (yoff > img_max)

    {
    if (dirty_top[blk] == -1)
      dirty_top[blk] = y;
    }
  else if (memcmp(guest + yoff + xoff,
                  mirror + yoff + xoff,
                  bw * bpp) == 0)
    {

...

#1 lore raw
Quoted 27 lines · perrier vincent

Using a very old guest (lenny) with spice and vga=cirrus, I have a segfault:

FILE:      ui/spice-display.c
FUNCTION:  qemu_spice_create_update
LINE:      if (memcmp(guest + yoff + xoff,

mirror + yoff + xoff,
bw * bpp) == 0)

The address of mirror + yoff + xoff is out of boundaries.

I use the following to avoid the crash:

...
img_get_stride = pixman_image_get_stride(ssd->mirror); img_height = pixman_image_get_height(ssd->mirror); img_max = img_height * img_get_stride;
...
if (yoff > img_max)

    {
    if (dirty_top[blk] == -1)
      dirty_top[blk] = y;
    }
  else if (memcmp(guest + yoff + xoff,
                  mirror + yoff + xoff,
                  bw * bpp) == 0)
    {
Quoted 1 line

...

Thanks for the report. I have CCed Gerd Hoffmann who maintains the graphics subsystem.

#2 lore raw
Quoted 3 lines · Stefan Hajnoczi
Quoted 2 lines · perrier vincent

Using a very old guest (lenny) with spice and vga=cirrus, I have a segfault:

Hmm, doesn't reproduce on master (booting i386 lenny install iso). Which qemu version is this?

Quoted 10 lines
Quoted 10 lines
FILE:      ui/spice-display.c
FUNCTION:  qemu_spice_create_update
LINE:      if (memcmp(guest + yoff + xoff,

mirror + yoff + xoff,
bw * bpp) == 0)

The address of mirror + yoff + xoff is out of boundaries.

I use the following to avoid the crash:

Quoted 10 lines
Quoted 10 lines

...
img_get_stride = pixman_image_get_stride(ssd->mirror); img_height = pixman_image_get_height(ssd->mirror); img_max = img_height * img_get_stride;
...
if (yoff > img_max)

    {
    if (dirty_top[blk] == -1)
      dirty_top[blk] = y;
    }

I'm wondering how you end up with yoff being ouf of boundaries in the first place ...

cheers,
Gerd