From 6c7ad4059bca7de0c77d13e4899c5a352cb98922 Mon Sep 17 00:00:00 2001 From: aarzilli Date: Wed, 27 Jan 2016 13:21:26 +0100 Subject: [PATCH] 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) --- proc/mem.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proc/mem.go b/proc/mem.go index 83cb14be..80b5daa3 100644 --- a/proc/mem.go +++ b/proc/mem.go @@ -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