proc/variables: crash while reading unintialized variable

Fixes #384
This commit is contained in:
aarzilli
2016-01-30 22:21:07 +01:00
committed by Derek Parker
parent ae6a5f503c
commit 06bba9b7a9
3 changed files with 35 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package proc
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"go/constant"
"go/parser"
@ -927,6 +928,10 @@ func (v *Variable) loadArrayValues(recurseLevel int) {
if v.Unreadable != nil {
return
}
if v.Len < 0 {
v.Unreadable = errors.New("Negative array length")
return
}
count := v.Len
// Cap number of elements