From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1S9PGy-0007bP-DH for mharc-grub-devel@gnu.org; Sun, 18 Mar 2012 19:12:24 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9PGw-0007av-Fc for grub-devel@gnu.org; Sun, 18 Mar 2012 19:12:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9PGu-0001hO-Or for grub-devel@gnu.org; Sun, 18 Mar 2012 19:12:22 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:62664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9PGu-0001h2-GB for grub-devel@gnu.org; Sun, 18 Mar 2012 19:12:20 -0400 Received: by wibhj13 with SMTP id hj13so2335533wib.12 for ; Sun, 18 Mar 2012 16:12:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; bh=R08/dpacRGt8ZDAfZY6f1Xj4RHR+AIIO1o+myDwXDoE=; b=kMetpT1h7LrD6lRRN2Z6ctI0F6jx98ZGdPgPB0hOCXLitW6XTvYzkd6CP+bU2H3WkP P+DUp0egGVHZECcJBO5UlS3Zt4FS1d/+Zs2O5baN42dyGzNRSdo0Hx//PNfKBdA6nhtR wDAjp+XUD+nD15lGEegCT0Xj57S7jQnk+Aw1HkJ3O79bV7CbDI2OLUKGGQ2wZ8L3eQ2o huGPjaUOjPHe8XrrLl/JaJNBcBJEFTcWy9NnZWqyOccVxeSxSnD2BiE3duETh51oLF3M Tmiivd3vnfhKS6IsI2pzEuWLejfsyyqjSLAt6MvvjuHi2tJaw503wPweI+7X0HqvKXQw x9WA== Received: by 10.216.133.139 with SMTP id q11mr5811617wei.44.1332112337691; Sun, 18 Mar 2012 16:12:17 -0700 (PDT) Received: from [192.168.1.37] (c2433-1-88-160-112-182.fbx.proxad.net. [88.160.112.182]) by mx.google.com with ESMTPS id fn2sm20062210wib.0.2012.03.18.16.12.16 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Mar 2012 16:12:17 -0700 (PDT) Message-ID: <4F666BD0.6050103@gmail.com> Date: Mon, 19 Mar 2012 00:12:16 +0100 From: =?ISO-8859-1?Q?Gr=E9goire_Sutre?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111114 Iceowl/1.0b2 Icedove/3.1.16 MIME-Version: 1.0 To: The development of GNU GRUB Subject: [patch] fix out-of-bounds error Content-Type: multipart/mixed; boundary="------------070908020405010608020007" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.171 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 23:12:23 -0000 This is a multi-part message in MIME format. --------------070908020405010608020007 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit I get the following warning on Debian GNU/Linux when compiling with -O2. This is with GCC 4.6.3. $ CFLAGS='-O2' ./configure && make ... gdb/cstub.c: In function 'grub_gdb_trap': gdb/cstub.c:83:21: error: array subscript is above array bounds [-Werror=array-bounds] cc1: all warnings being treated as errors make[3]: *** [gdb/gdb_module-cstub.o] Error 1 make[3]: Leaving directory `/tmp/GRUB/trunk/grub-core' Afaics, the out-of-bounds error is real, and the attached patch fixes it. Grégoire --------------070908020405010608020007 Content-Type: text/x-patch; name="gdb_cstub.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gdb_cstub.diff" === modified file 'grub-core/gdb/cstub.c' --- grub-core/gdb/cstub.c 2012-02-26 18:10:52 +0000 +++ grub-core/gdb/cstub.c 2012-03-18 13:46:51 +0000 @@ -57,27 +57,27 @@ grub_gdb_getpacket (void) while (1) { /* Wait around for the start character, ignore all other characters. */ while ((ch = grub_serial_port_fetch (grub_gdb_port)) != '$'); retry: checksum = 0; xmitcsum = -1; count = 0; /* Now read until a # or end of buffer is found. */ - while (count < GRUB_GDB_COMBUF_SIZE) + while (count < GRUB_GDB_COMBUF_SIZE - 1) { do ch = grub_serial_port_fetch (grub_gdb_port); while (ch < 0); if (ch == '$') goto retry; if (ch == '#') break; checksum += ch; buffer[count] = ch; count = count + 1; } buffer[count] = 0; --------------070908020405010608020007--