From ba664a3ef4315862af51b41d37231673d7e11a32 Mon Sep 17 00:00:00 2001 From: pkujhd Date: Thu, 18 Feb 2021 15:00:33 +0800 Subject: [PATCH] adapter linux/arm64, check _func.nameoff array bounds --- register.1.16.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/register.1.16.go b/register.1.16.go index 2887a969..9e957b28 100644 --- a/register.1.16.go +++ b/register.1.16.go @@ -13,9 +13,11 @@ func registerFunc(md *moduledata, symPtr map[string]uintptr) { for _, f := range md.ftab { if int(f.funcoff) < len(md.pclntable) { _func := (*_func)(unsafe.Pointer((&(md.pclntable[f.funcoff])))) - name := gostringnocopy(&(md.funcnametab[_func.nameoff])) - if !strings.HasPrefix(name, TypeDoubleDotPrefix) && _func.entry < md.etext { - symPtr[name] = _func.entry + if int(_func.nameoff) < len(md.funcnametab) { + name := gostringnocopy(&(md.funcnametab[_func.nameoff])) + if !strings.HasPrefix(name, TypeDoubleDotPrefix) && _func.entry < md.etext { + symPtr[name] = _func.entry + } } } }