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

Segfault in spd_close() #762

Closed
Parakleta opened this issue Aug 28, 2022 · 2 comments
Closed

Segfault in spd_close() #762

Parakleta opened this issue Aug 28, 2022 · 2 comments

Comments

@Parakleta
Copy link

The changes made in dc945d8 lead to a SegFault on FreeBSD due to an attempt to close a null FILE *.

I think the relevant code should look like:

    if (connection->stream != NULL)
        fclose(connection->stream);
    connection->stream = NULL;
    close(connection->socket);

This mimics the closure behaviour on error in get_reply() in the same file.

@sthibaul
Copy link
Collaborator

Thanks for the report!
(I however don't think we shall close the underlying socket, fclose does that already)

@Parakleta
Copy link
Author

Parakleta commented Aug 28, 2022

Yes, you are correct. I hadn’t followed the fdopen behaviour correctly.

I based my assumptions off the behaviour here:

fclose(connection->stream);
close(connection->socket);
free(connection);

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this issue Sep 7, 2022
A bug in speed-dispatcher lead to a crash in okular (as
speech-dispatcher was segfaulting).

Upstream PR:	https://bugs.kde.org/show_bug.cgi?id=458762
Upstream PR:	brailcom/speechd#762
mgorse pushed a commit to mgorse/speechd that referenced this issue May 22, 2024
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

No branches or pull requests

2 participants