From 7c37a1ef63fa61406cc7a96f2973e7eedb11570f Mon Sep 17 00:00:00 2001 From: Vikram Rangnekar Date: Sun, 21 Apr 2019 01:08:51 -0400 Subject: [PATCH] Fix null pointer with invalid argument values --- qcode/qcode.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/qcode/qcode.go b/qcode/qcode.go index 2308d05..c9095ea 100644 --- a/qcode/qcode.go +++ b/qcode/qcode.go @@ -423,6 +423,10 @@ func (com *Compiler) compileArgNode(val *Node) (*Exp, error) { st := util.NewStack() var root *Exp + if val == nil || len(val.Children) == 0 { + return nil, errors.New("invalid argument value") + } + st.Push(&expT{nil, val.Children[0]}) for {