1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-14 17:50:22 +02:00

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.
This commit is contained in:
pcpa 2015-02-07 17:08:43 -02:00
parent f6970c62cf
commit fb21cf9f38
2 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2015-02-07 Paulo Andrade <pcpa@gnu.org>
* 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 <pcpa@gnu.org>
* lib/lightning.c: Correct the reason the bug in

View file

@ -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