Commit 14a7edc7 authored by Nick Thomas's avatar Nick Thomas

Merge branch 'jv-add-missing-bounds-checks' into 'master'

Add missing bounds checks in LSIF parser

See merge request gitlab-org/gitlab-workhorse!527
parents 027c123a c1fe1201
......@@ -14,7 +14,7 @@ const (
type Id int32
func (id *Id) UnmarshalJSON(b []byte) error {
if b[0] != '"' {
if len(b) > 0 && b[0] != '"' {
if err := id.unmarshalInt(b); err != nil {
return err
}
......
......@@ -2,6 +2,7 @@ package parser
import (
"encoding/json"
"errors"
"io"
"strconv"
)
......@@ -177,6 +178,10 @@ func (r *Ranges) addItem(line []byte) error {
}
func (r *Ranges) addDefRef(defRef *RawDefRef) error {
if len(defRef.RangeIds) == 0 {
return errors.New("no range IDs")
}
var rg Range
if err := r.Cache.Entry(defRef.RangeIds[0], &rg); err != nil {
return err
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment