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

Dereference of nil in WriteColorFile #67

Open
sminux opened this issue Oct 29, 2024 · 0 comments · May be fixed by #68
Open

Dereference of nil in WriteColorFile #67

sminux opened this issue Oct 29, 2024 · 0 comments · May be fixed by #68

Comments

@sminux
Copy link

sminux commented Oct 29, 2024

If q, err := New(content, level) returns an error when the content is too long
https://github.com/skip2/go-qrcode/blob/da1b6568686e89143e94f980a98bc2dbd5537f13/qrcode.go#L114C2-L114C31
'q' may be nil and is dereferenced at qrcode.go:116.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10061adb8]

Err check must be before the lines

go-qrcode/qrcode.go

Lines 116 to 117 in da1b656

q.BackgroundColor = background
q.ForegroundColor = foreground

@sminux sminux linked a pull request Oct 29, 2024 that will close this issue
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