Skip to content

Conversation

ailin-nemui
Copy link
Contributor

this fixes a crash on /quit when the module unloaded is trying to reference symbols from already-unloaded modules, by reversing the lists.

this fixes a crash on /quit when the module unloaded is trying
to reference symbols from already-unloaded modules, by reversing
the lists.
@ailin-nemui
Copy link
Contributor Author

originally reported by letty

@ailin-nemui
Copy link
Contributor Author

as a side effect, this will reverse the output of /load. not sure if that's anything to worry about

@ailin-nemui ailin-nemui added the auto-merge This PR is scheduled for merge if no further comments are opened label Apr 2, 2020
@ailin-nemui
Copy link
Contributor Author

@irssi/developers

@ailin-nemui ailin-nemui merged commit 8b7bf1f into irssi:master Apr 3, 2020
@ailin-nemui ailin-nemui deleted the quit-crash branch April 3, 2020 21:26
@dequis
Copy link
Member

dequis commented Apr 4, 2020

Can you post some specifics? Seems like a rather arbitrary fix without context.

@ailin-nemui
Copy link
Contributor Author

if we /load perl, then Irssi will append "core", then "fe", to module->files

module->files = g_slist_append(module->files, file);

on quit, Irssi will unload all modules by iterating over module->files:

module_file_unload(module->files->data);

when the fe-perl is unloaded, it will call perl_core_print_script_error:

perl_core_print_script_error(TRUE);

at that time, due to the order of the list (first "core" is unloaded, then "fe"), this function already ceased to exist:

void perl_core_print_script_error(int print)

that leads to a segfault on openbsd

@ailin-nemui
Copy link
Contributor Author

by reverting the list, a module that loads "core" and "fe" will put "fe", then "core" in the list. now, the unloading will be "fe", then "core", thus avoiding the crash

@dequis
Copy link
Member

dequis commented Apr 4, 2020

Thanks!

@ailin-nemui ailin-nemui added this to the 1.2.3 milestone Apr 8, 2021
ailin-nemui added a commit that referenced this pull request Apr 8, 2021
fix crash on /quit when unloading modules

(cherry picked from commit 8b7bf1f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge This PR is scheduled for merge if no further comments are opened
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants