[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 372/437: Properly correct read of freed memory
From: |
Andy Wingo |
Subject: |
[Guile-commits] 372/437: Properly correct read of freed memory |
Date: |
Mon, 2 Jul 2018 05:14:58 -0400 (EDT) |
wingo pushed a commit to branch lightning
in repository guile.
commit 1507bc7ee5506785b6efba3ff79ad795c1f93ed7
Author: pcpa <address@hidden>
Date: Sun Mar 8 16:22:10 2015 -0300
Properly correct read of freed memory
---
doc/body.texi | 12 ++++++------
doc/printf.c | 2 +-
lib/lightning.c | 10 ++++++++++
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/doc/body.texi b/doc/body.texi
index a527db7..23b8b8f 100644
--- a/doc/body.texi
+++ b/doc/body.texi
@@ -1068,10 +1068,10 @@ int main(int argc, char *argv[])
@rem{/* call the generated address@hidden passing its size as argument */}
myFunction((char*)jit_address(end) - (char*)jit_address(start));
+ jit_clear_state();
jit_disassemble();
- jit_clear_state();
jit_destroy_state();
finish_jit();
return 0;
@@ -1127,15 +1127,15 @@ call must be done after the @code{emit} call or either
a fatal error
will happen (if @lightning{} is built with assertions enable) or an
undefined value will be returned.
address@hidden jit_disassemble();
address@hidden will dump the generated code to standard output,
-unless @lightning{} was built with the disassembler disabled, in which
-case no output will be shown.
-
@item jit_clear_state();
Note that @code{jit_clear_state} was called after executing jit in
this example. It was done because it must be called after any call
to @code{jit_address} or @code{jit_print}.
+
address@hidden jit_disassemble();
address@hidden will dump the generated code to standard output,
+unless @lightning{} was built with the disassembler disabled, in which
+case no output will be shown.
@end table
@node RPN calculator
diff --git a/doc/printf.c b/doc/printf.c
index 2ab0738..8548541 100644
--- a/doc/printf.c
+++ b/doc/printf.c
@@ -30,10 +30,10 @@ int main(int argc, char *argv[])
/* call the generated code, passing its size as argument */
myFunction((char*)jit_address(end) - (char*)jit_address(start));
+ jit_clear_state();
jit_disassemble();
- jit_clear_state();
jit_destroy_state();
finish_jit();
return 0;
diff --git a/lib/lightning.c b/lib/lightning.c
index 949deea..5dce92e 100644
--- a/lib/lightning.c
+++ b/lib/lightning.c
@@ -832,6 +832,13 @@ jit_new_state(void)
void
_jit_clear_state(jit_state_t *_jit)
{
+#if DEVEL_DISASSEMBLER
+# define jit_really_clear_state() _jit_really_clear_state(_jit)
+}
+
+void _jit_really_clear_state(jit_state_t *_jit)
+{
+#endif
jit_word_t offset;
jit_function_t *function;
@@ -889,6 +896,9 @@ _jit_clear_state(jit_state_t *_jit)
void
_jit_destroy_state(jit_state_t *_jit)
{
+#if DEVEL_DISASSEMBLER
+ jit_really_clear_state();
+#endif
if (!_jit->user_code)
munmap(_jit->code.ptr, _jit->code.length);
if (!_jit->user_data)
- [Guile-commits] 140/437: Add new test cases to exercise memory load/store., (continued)
- [Guile-commits] 140/437: Add new test cases to exercise memory load/store., Andy Wingo, 2018/07/02
- [Guile-commits] 267/437: GNU lightning 2.0.2 release, Andy Wingo, 2018/07/02
- [Guile-commits] 275/437: GNU lightning 2.0.3 release, Andy Wingo, 2018/07/02
- [Guile-commits] 338/437: Add missing ellipsis mark to align.tst, Andy Wingo, 2018/07/02
- [Guile-commits] 269/437: ARM: Minor changes that should allow building on non gnu-linux/gcc., Andy Wingo, 2018/07/02
- [Guile-commits] 260/437: Correct source of the self test case and a missed check failure., Andy Wingo, 2018/07/02
- [Guile-commits] 216/437: Prepare for the first alpha release of lightning 2.0., Andy Wingo, 2018/07/02
- [Guile-commits] 385/437: ia64: Add initial jit_va_ calls to ia64, Andy Wingo, 2018/07/02
- [Guile-commits] 382/437: mips: Add initial jit_va_ calls to mips, Andy Wingo, 2018/07/02
- [Guile-commits] 353/437: Remove inconsistent, public jit_arg_reg_p macro, Andy Wingo, 2018/07/02
- [Guile-commits] 372/437: Properly correct read of freed memory,
Andy Wingo <=
- [Guile-commits] 281/437: Implement the new jit_set_data interface., Andy Wingo, 2018/07/02
- [Guile-commits] 329/437: cross: Provide the action for the cross compiling case, Andy Wingo, 2018/07/02
- [Guile-commits] 178/437: Update texinfo documentation to match current implementation., Andy Wingo, 2018/07/02
- [Guile-commits] 392/437: Bump library major., Andy Wingo, 2018/07/02
- [Guile-commits] 398/437: ia64: Pass all tests for variadic jit functions, Andy Wingo, 2018/07/02
- [Guile-commits] 397/437: Implement new synthesized IR codes sequences, Andy Wingo, 2018/07/02
- [Guile-commits] 410/437: GNU lightning 2.1.2 release, Andy Wingo, 2018/07/02
- [Guile-commits] 270/437: x86: Use aligned offset for x87 to/from sse move., Andy Wingo, 2018/07/02
- [Guile-commits] 302/437: Add info menu entry for lightning, Andy Wingo, 2018/07/02
- [Guile-commits] 214/437: Remove remaining ia64 port debug code., Andy Wingo, 2018/07/02