Skip to content

Fix cache UI actions without UI context - #8508

Open
plafosse wants to merge 1 commit into
devfrom
test_fix_kernel_cache_crash
Open

Fix cache UI actions without UI context#8508
plafosse wants to merge 1 commit into
devfrom
test_fix_kernel_cache_crash

Conversation

@plafosse

@plafosse plafosse commented Sep 2, 2026

Copy link
Copy Markdown
Member

Fix cache image-loading actions invoked without an active UI context, preventing null dereferences during background execution. Also applies the same protection to dyld shared-cache actions.

Repro:

First select the unloaded green address then run:

from binaryninja import execute_on_main_thread_and_wait
from binaryninjaui import UIContext

def repro_bnkc4():
    ui = UIContext.activeContext()
    view = ui.getCurrentViewFrame().getCurrentViewInterface()
    handler = view.actionHandler()
    ctx = view.actionContext()

    assert handler.isValidAction("KC Load IMGHERE", ctx), \
        "Select an unloaded off-image address first"

    ctx.context = None
    handler.executeAction("KC Load IMGHERE", ctx)

execute_on_main_thread_and_wait(repro_bnkc4)

This should fix issue: https://github.com/Vector35/binaryninja/issues/1898

@plafosse plafosse added this to the L milestone Sep 2, 2026
@plafosse
plafosse requested a review from bdash September 2, 2026 16:17

@zznop zznop left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good to me. Looks like all cache action paths are addressed and it prevents dereferencing a null context pointer. When the context is NULL I assume that it's possible work can outlive the UI. But, I think we permit that elsewhere.

@bdash bdash left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine as a defensive fix, but we should file a follow-up issue about the fact that a context menu item invoked an action with a null UIContext.

@plafosse plafosse self-assigned this Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants