Fix accepatable address range

This commit is contained in:
Masaaki Goshima 2021-01-31 02:30:48 +09:00
parent 1c0b7e7c7d
commit 90c2560b52
1 changed files with 3 additions and 3 deletions

View File

@ -36,8 +36,8 @@ type compiledCode struct {
} }
const ( const (
bufSize = 1024 bufSize = 1024
maxTypeAddrRange = 1024 * 1024 * 16 // 16 Mib maxAcceptableTypeAddrRange = 1024 * 1024 * 2 // 2 Mib
) )
const ( const (
@ -111,7 +111,7 @@ func setupOpcodeSets() error {
if addrRange == 0 { if addrRange == 0 {
return fmt.Errorf("failed to get address range of types") return fmt.Errorf("failed to get address range of types")
} }
if addrRange > maxTypeAddrRange { if addrRange > maxAcceptableTypeAddrRange {
return fmt.Errorf("too big address range %d", addrRange) return fmt.Errorf("too big address range %d", addrRange)
} }
cachedOpcodeSets = make([]*opcodeSet, addrRange) cachedOpcodeSets = make([]*opcodeSet, addrRange)