From: Thiemo Seufer <ths@networkno.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [4731] Avoid gen_opc_buf overflow.
Date: Wed, 11 Jun 2008 12:26:30 +0000 [thread overview]
Message-ID: <E1K6PPJ-00055C-VV@cvs.savannah.gnu.org> (raw)
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
reply other threads:[~2008-06-11 12:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1K6PPJ-00055C-VV@cvs.savannah.gnu.org \
--to=ths@networkno.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).