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

SIGSEGV in components.go with too large files for timeout #10

Open
vnob opened this issue Mar 1, 2022 · 1 comment
Open

SIGSEGV in components.go with too large files for timeout #10

vnob opened this issue Mar 1, 2022 · 1 comment

Comments

@vnob
Copy link

vnob commented Mar 1, 2022

Getting a stack crash on a timeout in the gonexus api which is located here

	if _ , resp, err := rm.Do(req); err != nil /* && resp.StatusCode != http.StatusNoContent*/ {
		return doError(err)
	}

will sigsegv with this type of error

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x620f0f]

goroutine 1 [running]:
gonexus/rm.UploadComponent({0x70b868, 0xc000078230}, {0x7fff259a4f07, 0xd}, {0x702f20, 0xc00002a2c0})
        ~/nexus_api/gonexus/rm/components.go:394 +0x6cf
main.upload_components({0x70b868, 0xc000078230}, {0x7fff259a4f07, 0xd}, {0x7fff259a4f15, 0x4}, {0x7fff259a4f1a, 0x7}, {0xc000151e60, 0x1b})
        ~nexus_api/nexus_api.go:76 +0x2c6
main.main()
        ~/nexus_api/nexus_api.go:126 +0x5f8

The problem is the rm.Do(req) in ~ Components.go:394
if the Do function returns a timeout error then accessing resp again will cause a stack crash. My solution was to change the line to this

	if _ , _, err := rm.Do(req); err != nil {
		return doError(err)
	}

will correctly print the timeout error I am not sure what that code was there for but it may need to be fixed differently.

To reproduce do a nexusrm.UploadComponent with a file larger then can be uploaded then the timeout in nexus.go file and it will sigsegv. Since its returning

	if err != nil {
		return nil, nil, err
	}

If you need more details let me know.

@franchb
Copy link

franchb commented Aug 9, 2022

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

2 participants