Skip to contentSkip to conversation

index out of bounds in qemu-0.10.2

Qemu-devel Sergei Steshenko 1 participant 1 message Apr 18, 2009

lore
Share & tools
lore
#0 lore raw
Quoted 63 lines · Blue Swirl

From: Blue Swirl <[email protected]>
Subject: Re: [Qemu-devel] index out of bounds in qemu-0.10.2
To: [email protected], "Andrzej Zaborowski" <[email protected]>
Date: Saturday, April 18, 2009, 11:25 AM

Quoted 3 lines · Sergei Steshenko

Hello,

  I am compiling qemu-0.10.2 using the attached

autogenerated 'configure'

Quoted 1 line

  wrapper (if anybody is interested in 'configure'

command line options I'm

Quoted 3 lines

  using_.

  I am using self-built gcc-4.3.3, my OS is SUSE

10.3, 32 bits.

Quoted 4 lines

  While running 'make' I've noticed this:

      41

/mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw/twl92230.c:
In function ‘menelaus_load’:

Quoted 1 line

      42

/mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw/hw.h:114:
warning: array subscript is above array bounds

Quoted 1 line

      43

/mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw/hw.h:114:
warning: array subscript is above array bounds

Quoted 1 line

      44

/mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw/hw.h:114:
warning: array subscript is above array bounds

Quoted 1 line

      45

/mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw/twl92230.c:
In function ‘menelaus_save’:

Quoted 1 line

      46

/mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw/hw.h:94:
warning: array subscript is above array bounds

Quoted 1 line

      47

/mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw/hw.h:94:
warning: array subscript is above array bounds

Quoted 1 line

      48

/mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw/hw.h:94:
warning: array subscript is above array bounds

Quoted 3 lines

  .

  Once I had the same warnings compiling my own

code, and 'gcc' was correct,

Quoted 3 lines

  so most likely it's correct in this case too.

  If so, please fix this.

My gcc and even sparse is completely silent, strange.

It's because of this area:

    uint8_t dcdc[3];

is saved like this:

    qemu_put_8s(f, &s->dcdc[3]);
    qemu_put_8s(f, &s->dcdc[3]);
    qemu_put_8s(f, &s->dcdc[3]);

Quoted 10 lines

and loaded like this:

    qemu_get_8s(f, &s->dcdc[3]);
    qemu_get_8s(f, &s->dcdc[3]);
    qemu_get_8s(f, &s->dcdc[3]);

which is of course wrong.

What is your 'gcc' version ?

I think 'gcc' strictness began from gcc-4.2.0, and the developers have been adding strictness features since.

Thanks,
Sergei.