Commit c1fe1201 authored by Jacob Vosmaer's avatar Jacob Vosmaer Committed by Nick Thomas

Add missing bounds checks in LSIF parser

parent 027c123a
......@@ -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