proc: Possible panic while reading uninitialised memory
If uninitialized memory is read loadArrayValues could try to call cacheMemory with a negative size, which could cause a 'makeslice: len out of range' panic. Fixes #354 (partial)
This commit is contained in:
parent
d756eba13a
commit
6c7ad4059b
@ -35,6 +35,9 @@ func cacheMemory(mem memoryReadWriter, addr uintptr, size int) memoryReadWriter
|
|||||||
if !cacheEnabled {
|
if !cacheEnabled {
|
||||||
return mem
|
return mem
|
||||||
}
|
}
|
||||||
|
if size <= 0 {
|
||||||
|
return mem
|
||||||
|
}
|
||||||
if cacheMem, isCache := mem.(*memCache); isCache {
|
if cacheMem, isCache := mem.(*memCache); isCache {
|
||||||
if cacheMem.contains(addr, size) {
|
if cacheMem.contains(addr, size) {
|
||||||
return mem
|
return mem
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user