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:
aarzilli
2016-01-27 13:21:26 +01:00
parent d756eba13a
commit 6c7ad4059b

View File

@ -35,6 +35,9 @@ func cacheMemory(mem memoryReadWriter, addr uintptr, size int) memoryReadWriter
if !cacheEnabled {
return mem
}
if size <= 0 {
return mem
}
if cacheMem, isCache := mem.(*memCache); isCache {
if cacheMem.contains(addr, size) {
return mem