diff options
| author | Philipp Stephani | 2020-11-29 21:13:02 +0100 |
|---|---|---|
| committer | Philipp Stephani | 2020-11-29 21:13:02 +0100 |
| commit | 41c338474dd1e086494337fd18ec8828cef1a75c (patch) | |
| tree | 31e090e26e3bda495f984c0a634e21cfe0ecf0ce /test/src/emacs-module-resources | |
| parent | 367727b0f6ed2468c909b9883740bff101d5a68f (diff) | |
| download | emacs-41c338474dd1e086494337fd18ec8828cef1a75c.tar.gz emacs-41c338474dd1e086494337fd18ec8828cef1a75c.zip | |
Fix double-free bug when finalizing module runtimes.
* src/emacs-module.c (finalize_runtime_unwind): Don't finalize initial
environment twice.
* test/src/emacs-module-resources/mod-test.c (emacs_module_init):
Allocate lots of values during module initialization to trigger the
bug.
Diffstat (limited to 'test/src/emacs-module-resources')
| -rw-r--r-- | test/src/emacs-module-resources/mod-test.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/src/emacs-module-resources/mod-test.c b/test/src/emacs-module-resources/mod-test.c index 419621256ae..f855e9b6da0 100644 --- a/test/src/emacs-module-resources/mod-test.c +++ b/test/src/emacs-module-resources/mod-test.c | |||
| @@ -806,6 +806,12 @@ emacs_module_init (struct emacs_runtime *ert) | |||
| 806 | strlen (interactive_spec))); | 806 | strlen (interactive_spec))); |
| 807 | bind_function (env, "mod-test-identity", identity_fn); | 807 | bind_function (env, "mod-test-identity", identity_fn); |
| 808 | 808 | ||
| 809 | /* We allocate lots of values to trigger bugs in the frame allocator during | ||
| 810 | initialization. */ | ||
| 811 | int count = 10000; /* larger than value_frame_size in emacs-module.c */ | ||
| 812 | for (int i = 0; i < count; ++i) | ||
| 813 | env->make_integer (env, i); | ||
| 814 | |||
| 809 | provide (env, "mod-test"); | 815 | provide (env, "mod-test"); |
| 810 | return 0; | 816 | return 0; |
| 811 | } | 817 | } |