go-qrcode icon indicating copy to clipboard operation
go-qrcode copied to clipboard

Dereference of nil in WriteColorFile

Open sminux opened this issue 3 months ago • 0 comments

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 https://github.com/skip2/go-qrcode/blob/da1b6568686e89143e94f980a98bc2dbd5537f13/qrcode.go#L116-L117

sminux avatar Oct 29 '24 20:10 sminux