From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K6PPN-0004sn-Le for qemu-devel@nongnu.org; Wed, 11 Jun 2008 08:26:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K6PPM-0004rG-94 for qemu-devel@nongnu.org; Wed, 11 Jun 2008 08:26:33 -0400 Received: from [199.232.76.173] (port=59097 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6PPM-0004r6-1h for qemu-devel@nongnu.org; Wed, 11 Jun 2008 08:26:32 -0400 Received: from savannah.gnu.org ([199.232.41.3]:43319 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K6PPL-0001Qj-MV for qemu-devel@nongnu.org; Wed, 11 Jun 2008 08:26:31 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1K6PPK-00055K-NV for qemu-devel@nongnu.org; Wed, 11 Jun 2008 12:26:30 +0000 Received: from ths by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1K6PPJ-00055C-VV for qemu-devel@nongnu.org; Wed, 11 Jun 2008 12:26:30 +0000 MIME-Version: 1.0 Errors-To: ths Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Thiemo Seufer Message-Id: Date: Wed, 11 Jun 2008 12:26:30 +0000 Subject: [Qemu-devel] [4731] Avoid gen_opc_buf overflow. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4731 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4731 Author: ths Date: 2008-06-11 12:26:29 +0000 (Wed, 11 Jun 2008) Log Message: ----------- Avoid gen_opc_buf overflow. Modified Paths: -------------- trunk/target-mips/translate.c Modified: trunk/target-mips/translate.c =================================================================== --- trunk/target-mips/translate.c 2008-06-11 11:03:34 UTC (rev 4730) +++ trunk/target-mips/translate.c 2008-06-11 12:26:29 UTC (rev 4731) @@ -7229,7 +7229,8 @@ fprintf (logfile, "search pc %d\n", search_pc); pc_start = tb->pc; - gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; + /* Leave some spare opc slots for branch handling. */ + gen_opc_end = gen_opc_buf + OPC_MAX_SIZE - 16; ctx.pc = pc_start; ctx.saved_pc = -1; ctx.tb = tb; @@ -7254,7 +7255,7 @@ fprintf(logfile, "\ntb %p idx %d hflags %04x\n", tb, ctx.mem_idx, ctx.hflags); #endif - while (ctx.bstate == BS_NONE && gen_opc_ptr < gen_opc_end) { + while (ctx.bstate == BS_NONE) { if (env->nb_breakpoints > 0) { for(j = 0; j < env->nb_breakpoints; j++) { if (env->breakpoints[j] == ctx.pc) { @@ -7290,6 +7291,9 @@ if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) break; + if (gen_opc_ptr >= gen_opc_end) + break; + #if defined (MIPS_SINGLE_STEP) break; #endif