Skip to content

Commit ff40a02

Browse files
n471dmikefarah
authored andcommitted
Fix out of range panic in yaml decoder
1 parent 7d49d40 commit ff40a02

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pkg/yqlib/decoder_yaml.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ func (dec *yamlDecoder) Decode() (*CandidateNode, error) {
129129
return nil, err
130130
} else if err != nil {
131131
return nil, err
132+
} else if len(yamlNode.Content) == 0 {
133+
return nil, errors.New("yaml node has no content")
132134
}
133135

134136
candidateNode := CandidateNode{document: dec.documentIndex}

0 commit comments

Comments
 (0)