Skip to content

Commit

Permalink
gumjs: Fix crash in Stalker.flush() on a stopped sink
Browse files Browse the repository at this point in the history
This happens if Stalker.garbageCollect() was just called.

Co-authored-by: Alex Soler <[email protected]>
Co-authored-by: Francesco Tamagni <[email protected]>
  • Loading branch information
3 people committed Jan 11, 2024
1 parent b9fdec4 commit b11547c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
11 changes: 9 additions & 2 deletions bindings/gumjs/gumquickeventsink.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
* Copyright (C) 2020 Ole André Vadla Ravnås <[email protected]>
* Copyright (C) 2020-2024 Ole André Vadla Ravnås <[email protected]>
* Copyright (C) 2024 Alex Soler <[email protected]>
* Copyright (C) 2024 Francesco Tamagni <[email protected]>
*
* Licence: wxWindows Library Licence, Version 3.1
*/
Expand Down Expand Up @@ -222,7 +224,12 @@ gum_quick_js_event_sink_process (GumEventSink * sink,
static void
gum_quick_js_event_sink_flush (GumEventSink * sink)
{
gum_quick_js_event_sink_drain (GUM_QUICK_JS_EVENT_SINK (sink));
GumQuickJSEventSink * self = GUM_QUICK_JS_EVENT_SINK (sink);

if (self->core == NULL)
return;

gum_quick_js_event_sink_drain (self);
}

static void
Expand Down
11 changes: 9 additions & 2 deletions bindings/gumjs/gumv8eventsink.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/*
* Copyright (C) 2012-2022 Ole André Vadla Ravnås <[email protected]>
* Copyright (C) 2012-2024 Ole André Vadla Ravnås <[email protected]>
* Copyright (C) 2024 Alex Soler <[email protected]>
* Copyright (C) 2024 Francesco Tamagni <[email protected]>
*
* Licence: wxWindows Library Licence, Version 3.1
*/
Expand Down Expand Up @@ -226,7 +228,12 @@ gum_v8_js_event_sink_process (GumEventSink * sink,
static void
gum_v8_js_event_sink_flush (GumEventSink * sink)
{
gum_v8_js_event_sink_drain (GUM_V8_JS_EVENT_SINK (sink));
auto self = GUM_V8_JS_EVENT_SINK (sink);

if (self->core == NULL)
return;

gum_v8_js_event_sink_drain (self);
}

static void
Expand Down

0 comments on commit b11547c

Please sign in to comment.