Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua API: vis:pipe() causes a segfault when called before a window is open #1107

Closed
rnpnr opened this issue Jul 3, 2023 · 0 comments · Fixed by #1108
Closed

Lua API: vis:pipe() causes a segfault when called before a window is open #1107

rnpnr opened this issue Jul 3, 2023 · 0 comments · Fixed by #1108

Comments

@rnpnr
Copy link
Collaborator

rnpnr commented Jul 3, 2023

Since commit 424b219 vis will segfault if vis:pipe() is called when
no windows are open. This can happen if you have some function calling
vis:pipe() based on an event such as FILE_OPEN which doesn't actually
depend on a window being present. For example my vis-gpg plugin does
this when decrypting a file.

A temporary patch will follow in a pull request.

rnpnr added a commit to rnpnr/vis that referenced this issue Jul 3, 2023
rnpnr added a commit to rnpnr/vis that referenced this issue Jul 15, 2023
@rnpnr rnpnr closed this as completed in 47ac03a Jul 19, 2023
jeremybobbin pushed a commit to jeremybobbin/vis that referenced this issue Aug 17, 2024
When `file` was made optional the variable was changed to be initialized
by `vis->win->file` instead of a known safe file pointer. If `vis:pipe()`
is called based on the event `FILE_OPEN` the `file` parameter can be
valid even when `vis->win` is not yet present. Assuming `file` was
provided this would be handled later on if vis didn't segfault. By
initializing to NULL when `vis->win` isn't present `file` is given
a chance be handled later. In the case where `file` wasn't given and
`vis->win` is missing an error is thrown and `vis:pipe()` exits.

fixes martanne#1107 - Lua API: vis:pipe() causes a segfault when called before
a window is open
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 a pull request may close this issue.

1 participant