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

nip44: panic caused by uint16 overflow #134

Closed
sebdeveloper6952 opened this issue Jul 15, 2024 · 0 comments
Closed

nip44: panic caused by uint16 overflow #134

sebdeveloper6952 opened this issue Jul 15, 2024 · 0 comments

Comments

@sebdeveloper6952
Copy link
Contributor

unpaddedLen is a uint16:

unpaddedLen uint16

if unpaddedLen holds the value 65535, adding 2 results in an overflow and a panic in line 143:

unpadded = padded[2 : unpaddedLen+2]

panic: runtime error: slice bounds out of range [2:1]

goroutine 1 [running]:
github.com/nbd-wtf/go-nostr/nip44.Decrypt({0x140003a8000?, 0x14000390000?}, {0x14000026180, 0x20, 0x20})
	/Users/sebdev/Documents/sebas/projects/nostr/go-nostr/nip44/nip44.go:143 +0x5d4

Failing test case provided in my fork: https://github.com/sebdeveloper6952/go-nostr/blob/de50e524b7d7e41901b9ac07e9dda991166e3030/nip44/nip44_test.go#L227

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

1 participant