Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

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

@vnob

Description

@vnob

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions