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 error: Index out of range #6

Open
Masquerade0097 opened this issue May 13, 2020 · 3 comments
Open

Runtime error: Index out of range #6

Masquerade0097 opened this issue May 13, 2020 · 3 comments

Comments

@Masquerade0097
Copy link

I'm getting the following error when trying to run a package that uses go-forceexport. Here is the error log -

panic: runtime error: index out of range [66428884777697280] with length 15718508

goroutine 1 [running]:
github.com/rai-project/tensorflow/vendor/github.com/alangpierce/go-forceexport.FindFuncWithName(0x2b7d29a, 0x3d, 0x0, 0x0, 0xc0005bff98)
	/root/gopros/src/github.com/rai-project/tensorflow/vendor/github.com/alangpierce/go-forceexport/forceexport.go:61 +0x1fc
github.com/rai-project/tensorflow/vendor/github.com/alangpierce/go-forceexport.GetFunc(0x275ae20, 0x4b33e70, 0x2b7d29a, 0x3d, 0x2fa8f80, 0xc000808090)
	/root/gopros/src/github.com/rai-project/tensorflow/vendor/github.com/alangpierce/go-forceexport/forceexport.go:16 +0x30
github.com/rai-project/tensorflow/predictor.init.7()
	/root/gopros/src/github.com/rai-project/tensorflow/predictor/tf_private.go:76 +0x3c

System Details:
Go 1.13.10 on Linux for IBM Z/s390x

@A0nameless0man
Copy link

image

@saikei
Copy link

saikei commented Jul 26, 2021

GetFunc‘s principle is to traverse the symbol table.The get func has the bug, the ftab.funcoff maybe bigger than pclntable
please add

if int(ftab.funcoff) >= len(moduleData.pclntable) {
				continue
			}

whole func:

func FindFuncWithName(name string) (uintptr, error) {
	for moduleData := &Firstmoduledata; moduleData != nil; moduleData = moduleData.next {
		for _, ftab := range moduleData.ftab {
			if int(ftab.funcoff) >= len(moduleData.pclntable) {
				continue
			}
			f := (*runtime.Func)(unsafe.Pointer(&moduleData.pclntable[ftab.funcoff]))
			if f.Name() == name {
				return f.Entry(), nil
			}
		}
	}
	return 0, fmt.Errorf("Invalid function name: %s", name)
}

@YxYL6125
Copy link

YxYL6125 commented Aug 12, 2024

GetFunc‘s principle is to traverse the symbol table.The get func has the bug, the ftab.funcoff maybe bigger than pclntable please add

if int(ftab.funcoff) >= len(moduleData.pclntable) {
				continue
			}

whole func:

func FindFuncWithName(name string) (uintptr, error) {
	for moduleData := &Firstmoduledata; moduleData != nil; moduleData = moduleData.next {
		for _, ftab := range moduleData.ftab {
			if int(ftab.funcoff) >= len(moduleData.pclntable) {
				continue
			}
			f := (*runtime.Func)(unsafe.Pointer(&moduleData.pclntable[ftab.funcoff]))
			if f.Name() == name {
				return f.Entry(), nil
			}
		}
	}
	return 0, fmt.Errorf("Invalid function name: %s", name)
}

I met the same problem, but my confusion is that how the ftab.funcoff could bigger than pclntable

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

4 participants