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

runtime: segmentation fault with growslice due to calculation overflow #21586

Closed
martisch opened this issue Aug 24, 2017 · 1 comment
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@martisch
Copy link
Contributor

martisch commented Aug 24, 2017

go tip ea5e3bd but also earlier

The calculation uintptr(newcap) * et.size in growslice
for the below example wraps around to 32 (4*1073741832) on 386:

type T [1<<27 + 1]int64

var d T
var s []T

func main() {
	s = append(s, d, d, d, d)
	print(len(s), "\n")
}
unexpected fault address 0x5044e000
fatal error: fault
[signal SIGBUS: bus error code=0x2 addr=0x5044e000 pc=0x4402f]

Working on a fix in: https://golang.org/cl/55133

@martisch martisch added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 24, 2017
@martisch martisch self-assigned this Aug 24, 2017
@martisch martisch added this to the Go1.10 milestone Aug 24, 2017
@gopherbot
Copy link

Change https://golang.org/cl/55133 mentions this issue: runtime: protect growslice against newcap*et.size overflow

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants