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

panic (nil pointer dereference) in s3manager.Error.Error() when origErr is nil #1748

Closed
caseylucas opened this issue Jan 24, 2018 · 2 comments
Labels
bug This issue is a bug.

Comments

@caseylucas
Copy link
Contributor

Version of AWS SDK for Go?

v1.12.67

Version of Go (go version)?

go version go1.9.2 darwin/amd64

What issue did you see?

panic because of nil pointer dereference

panic(0xa952c0, 0xf29dd0)
        /usr/local/Cellar/go/1.9.2/libexec/src/runtime/panic.go:491 +0x283
github.com/aws/aws-sdk-go/service/s3/s3manager.(*Error).Error(0xc420537148, 0xc4201c2fc0, 0xc420363080)
        /Users/clucas/go/src/github.com/aws/aws-sdk-go/service/s3/s3manager/batch.go:63 +0x33

Steps to reproduce

If you have have an runnable example, please include it.

package main

import (
	"fmt"

	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/s3/s3manager"
)

func main() {
	fmt.Println("in main")
	err := s3manager.Error{
		Bucket: aws.String("bucket"),
		Key:    aws.String("key"),
	}
	fmt.Println(err.Error()) // <-- panic here
	/*
		panic: runtime error: invalid memory address or nil pointer dereference
		[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x126d693]

		goroutine 1 [running]:
		github.com/aws/aws-sdk-go/service/s3/s3manager.(*Error).Error(0xc420197f50, 0xc4200111d0, 0x1)
			/Users/clucas/go/src/github.com/aws/aws-sdk-go/service/s3/s3manager/batch.go:63 +0x33
		main.main()
		...
	*/
}
@jasdel
Copy link
Contributor

jasdel commented Jan 24, 2018

Thanks for finding and letting us know about this bug @caseylucas. I'll take a look at the PR you created.

@jasdel jasdel added the bug This issue is a bug. label Jan 24, 2018
@jasdel jasdel closed this as completed in 70713ce Jan 24, 2018
@jasdel
Copy link
Contributor

jasdel commented Jan 24, 2018

Thanks for putting this PR together @caseylucas, we've merged in the fix.

@awstools awstools mentioned this issue Jan 25, 2018
xibz pushed a commit to xibz/aws-sdk-go that referenced this issue Feb 15, 2018
S3 Manager's `Error` type did not check for nil of `OrigErr` when calling `Error()`

Fix aws#1748
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants