From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LvKoa-0000Eh-J6 for qemu-devel@nongnu.org; Sat, 18 Apr 2009 20:23:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LvKoU-00009q-Gm for qemu-devel@nongnu.org; Sat, 18 Apr 2009 20:23:19 -0400 Received: from [199.232.76.173] (port=51618 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LvKoU-00009i-CG for qemu-devel@nongnu.org; Sat, 18 Apr 2009 20:23:14 -0400 Received: from mail-bw0-f176.google.com ([209.85.218.176]:58341) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LvKoU-0005Jb-0j for qemu-devel@nongnu.org; Sat, 18 Apr 2009 20:23:14 -0400 Received: by bwz24 with SMTP id 24so264703bwz.8 for ; Sat, 18 Apr 2009 17:23:11 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <829169.28940.qm@web35202.mail.mud.yahoo.com> Date: Sun, 19 Apr 2009 02:23:11 +0200 Message-ID: Subject: Re: [Qemu-devel] index out of bounds in qemu-0.10.2 From: andrzej zaborowski Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel@nongnu.org 2009/4/18 Blue Swirl : > On 4/17/09, Sergei Steshenko wrote: >> Hello, >> >> =C2=A0I am compiling qemu-0.10.2 using the attached autogenerated 'confi= gure' >> =C2=A0wrapper (if anybody is interested in 'configure' command line opti= ons I'm >> =C2=A0using_. >> >> =C2=A0I am using self-built gcc-4.3.3, my OS is SUSE 10.3, 32 bits. >> >> =C2=A0While running 'make' I've noticed this: >> >> =C2=A0 =C2=A0 =C2=A041 /mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw= /twl92230.c: In function =E2=80=98menelaus_load=E2=80=99: >> =C2=A0 =C2=A0 =C2=A042 /mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw= /hw.h:114: warning: array subscript is above array bounds >> =C2=A0 =C2=A0 =C2=A043 /mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw= /hw.h:114: warning: array subscript is above array bounds >> =C2=A0 =C2=A0 =C2=A044 /mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw= /hw.h:114: warning: array subscript is above array bounds >> =C2=A0 =C2=A0 =C2=A045 /mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw= /twl92230.c: In function =E2=80=98menelaus_save=E2=80=99: >> =C2=A0 =C2=A0 =C2=A046 /mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw= /hw.h:94: warning: array subscript is above array bounds >> =C2=A0 =C2=A0 =C2=A047 /mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw= /hw.h:94: warning: array subscript is above array bounds >> =C2=A0 =C2=A0 =C2=A048 /mnt/sdb8/sergei/AFSWD_debug/build/qemu-0.10.2/hw= /hw.h:94: warning: array subscript is above array bounds >> =C2=A0. >> >> =C2=A0Once I had the same warnings compiling my own code, and 'gcc' was = correct, >> =C2=A0so most likely it's correct in this case too. >> >> =C2=A0If so, please fix this. > > My gcc and even sparse is completely silent, strange. > > It's because of this area: > > =C2=A0 =C2=A0uint8_t dcdc[3]; > > is saved like this: > > =C2=A0 =C2=A0qemu_put_8s(f, &s->dcdc[3]); > =C2=A0 =C2=A0qemu_put_8s(f, &s->dcdc[3]); > =C2=A0 =C2=A0qemu_put_8s(f, &s->dcdc[3]); > > and loaded like this: > > =C2=A0 =C2=A0qemu_get_8s(f, &s->dcdc[3]); > =C2=A0 =C2=A0qemu_get_8s(f, &s->dcdc[3]); > =C2=A0 =C2=A0qemu_get_8s(f, &s->dcdc[3]); Oops, good catch, I'll correct the indexes.