mirror of https://github.com/goccy/go-json.git
Fix accepatable address range
This commit is contained in:
parent
1c0b7e7c7d
commit
90c2560b52
|
@ -37,7 +37,7 @@ 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)
|
||||||
|
|
Loading…
Reference in New Issue