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

Fix panic invalid memory address or nil pointer dereference in privacysettings.go #579

Merged
merged 1 commit into from
May 7, 2024

Conversation

ruskotwo
Copy link
Contributor

@ruskotwo ruskotwo commented May 7, 2024

I encountered a panic

{"level":"error","message":"Failed to fetch privacy settings when handling change: [websocket disconnected before info query returned response]","time":"2024-04-29T14:07:33Z","wacId":"01fff71b-7938-4627-bf93-102ee3794b41"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x9911fe]

goroutine 1685089 [running]:
go.mau.fi/whatsmeow.(*Client).parsePrivacySettings(0xc067f12000?, 0xc05f86ff88, 0x0)
	go.mau.fi/[email protected]/privacysettings.go:140 +0x3be
go.mau.fi/whatsmeow.(*Client).handlePrivacySettingsNotification(0xc067f12000, 0xc0bd0d1f10?)
	go.mau.fi/[email protected]/privacysettings.go:159 +0xfa
go.mau.fi/whatsmeow.(*Client).handleAccountSyncNotification(0xc067f12000, 0xc02a112090)
	go.mau.fi/[email protected]/notification.go:199 +0x395
created by go.mau.fi/whatsmeow.(*Client).handleNotification
	go.mau.fi/[email protected]/notification.go:361 +0x69d

We got nil and error from cli.TryFetchPrivacySettings(). Error is logged, but then we go to cli.parsePrivacySettings() and pass the arguments *waBinary.Node and (!!!) nil.

This will result in an panic in most cases.

Copy link
Owner

@tulir tulir left a comment

Choose a reason for hiding this comment

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

Thanks!

@tulir tulir merged commit 01b0547 into tulir:main May 7, 2024
2 checks passed
crazycodezombie pushed a commit to crazycodezombie/whatsmeow that referenced this pull request May 28, 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

Successfully merging this pull request may close these issues.

2 participants