wingo pushed a commit to branch lightning
in repository guile.
commit fb21cf9f3806845ec3f3da704432a3759618a7b5
Author: pcpa <[email protected]>
Date: Sat Feb 7 17:08:43 2015 -0200
Avoid problems if JIT_INSTR_MAX is miscalculated
* lib/jit_size.c: Preventively use at least 144 bytes
if JIT_INSTR_MAX is less than it. The logic is not
guaranteed to be 100% precise, it is mostly heuristics
to allocate a buffer with as close as possible size,
but a wrong value may cause code generation to write
past the end of the buffer.
---
ChangeLog | 9 +++++++++
lib/jit_size.c | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 0a6fa04..336bf07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-02-07 Paulo Andrade <[email protected]>
+
+ * lib/jit_size.c: Preventively use at least 144 bytes
+ if JIT_INSTR_MAX is less than it. The logic is not
+ guaranteed to be 100% precise, it is mostly heuristics
+ to allocate a buffer with as close as possible size,
+ but a wrong value may cause code generation to write
+ past the end of the buffer.
+
2015-02-03 Paulo Andrade <[email protected]>
* lib/lightning.c: Correct the reason the bug in
diff --git a/lib/jit_size.c b/lib/jit_size.c
index ae4c633..612417e 100644
--- a/lib/jit_size.c
+++ b/lib/jit_size.c
@@ -110,7 +110,7 @@ _jit_get_size(jit_state_t *_jit)
jit_word_t
jit_get_max_instr(void)
{
- return (JIT_INSTR_MAX);
+ return (JIT_INSTR_MAX >= 144 ? JIT_INSTR_MAX : 144);
}
void