Skip to content

Avoid crashes when publishing without WebSocket contexts - #1933

Merged
uNetworkingAB merged 1 commit into
uNetworking:masterfrom
GetThatCookie:1924
Jul 31, 2026
Merged

Avoid crashes when publishing without WebSocket contexts#1933
uNetworkingAB merged 1 commit into
uNetworking:masterfrom
GetThatCookie:1924

Conversation

@GetThatCookie

Copy link
Copy Markdown
Contributor

Fixes #1924.

Return false from publish and publishPrepared, and 0 from numSubscribers, when no WebSocketContext has been configured.

This avoids dereferencing a null TopicTree without allocating one or registering loop handlers for HTTP-only apps.

A regression check was added to the existing HTTP-only fuzz target.

Tested by:

  • Building all examples
  • Running the complete ASan unit test suite
  • Running a targeted ASan/UBSan regression test

@uNetworkingAB
uNetworkingAB merged commit fe7da4c into uNetworking:master Jul 31, 2026
2 checks passed
@uNetworkingAB

Copy link
Copy Markdown
Contributor

Btw, you come from Node.js right? If so, how did you tackle the NPM change for Git dependencies? You just vendor the binaries?

@GetThatCookie

Copy link
Copy Markdown
Contributor Author

Not originally, but Node.js has pretty much become my new world. I’m still using npm 10 because newer npm versions have introduced too many issues in my workflows. So I haven’t had to deal with the Git dependency change yet - I just install the pinned Git dependency normally and don’t vendor the binaries.

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.

SIGSEGV in app.publish() / app.numSubscribers() without calling App.ws to define a WebSocketContext

2 participants