Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c1fe1201
Commit
c1fe1201
authored
Jul 13, 2020
by
Jacob Vosmaer
Committed by
Nick Thomas
Jul 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing bounds checks in LSIF parser
parent
027c123a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
internal/lsif_transformer/parser/id.go
internal/lsif_transformer/parser/id.go
+1
-1
internal/lsif_transformer/parser/ranges.go
internal/lsif_transformer/parser/ranges.go
+5
-0
No files found.
internal/lsif_transformer/parser/id.go
View file @
c1fe1201
...
@@ -14,7 +14,7 @@ const (
...
@@ -14,7 +14,7 @@ const (
type
Id
int32
type
Id
int32
func
(
id
*
Id
)
UnmarshalJSON
(
b
[]
byte
)
error
{
func
(
id
*
Id
)
UnmarshalJSON
(
b
[]
byte
)
error
{
if
b
[
0
]
!=
'"'
{
if
len
(
b
)
>
0
&&
b
[
0
]
!=
'"'
{
if
err
:=
id
.
unmarshalInt
(
b
);
err
!=
nil
{
if
err
:=
id
.
unmarshalInt
(
b
);
err
!=
nil
{
return
err
return
err
}
}
...
...
internal/lsif_transformer/parser/ranges.go
View file @
c1fe1201
...
@@ -2,6 +2,7 @@ package parser
...
@@ -2,6 +2,7 @@ package parser
import
(
import
(
"encoding/json"
"encoding/json"
"errors"
"io"
"io"
"strconv"
"strconv"
)
)
...
@@ -177,6 +178,10 @@ func (r *Ranges) addItem(line []byte) error {
...
@@ -177,6 +178,10 @@ func (r *Ranges) addItem(line []byte) error {
}
}
func
(
r
*
Ranges
)
addDefRef
(
defRef
*
RawDefRef
)
error
{
func
(
r
*
Ranges
)
addDefRef
(
defRef
*
RawDefRef
)
error
{
if
len
(
defRef
.
RangeIds
)
==
0
{
return
errors
.
New
(
"no range IDs"
)
}
var
rg
Range
var
rg
Range
if
err
:=
r
.
Cache
.
Entry
(
defRef
.
RangeIds
[
0
],
&
rg
);
err
!=
nil
{
if
err
:=
r
.
Cache
.
Entry
(
defRef
.
RangeIds
[
0
],
&
rg
);
err
!=
nil
{
return
err
return
err
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment