Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
cc6c155e
Commit
cc6c155e
authored
Apr 06, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
4e0c9ad3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
wcfs/zblk.go
wcfs/zblk.go
+11
-7
No files found.
wcfs/zblk.go
View file @
cc6c155e
...
@@ -50,6 +50,7 @@ import (
...
@@ -50,6 +50,7 @@ import (
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
"lab.nexedi.com/kirr/neo/go/zodb/btree"
pickle
"github.com/kisielk/og-rek"
pickle
"github.com/kisielk/og-rek"
"github.com/johncgriffin/overflow"
"./internal/pycompat"
"./internal/pycompat"
)
)
...
@@ -372,9 +373,12 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) (_ []byte, _ zodb.Tid, err err
...
@@ -372,9 +373,12 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) (_ []byte, _ zodb.Tid, err err
// find out whole blk len via inspecting tail chunk
// find out whole blk len via inspecting tail chunk
tailStart
:=
offv
[
len
(
offv
)
-
1
]
tailStart
:=
offv
[
len
(
offv
)
-
1
]
tailChunk
:=
chunktab
[
tailStart
]
tailChunk
:=
chunktab
[
tailStart
]
blklen
:=
tailStart
+
int32
(
len
(
tailChunk
.
data
))
// XXX overflow?
blklen
,
ok
:=
overflow
.
Add32
(
tailStart
,
int32
(
len
(
tailChunk
.
data
)))
if
!
ok
{
return
nil
,
0
,
fmt
.
Errorf
(
"invalid data: blklen overflow"
)
}
// whole buffer initialized as 0 + tail_chunk
// whole buffer initialized as 0 + tail_chunk
blkdata
:=
make
([]
byte
,
blklen
)
blkdata
:=
make
([]
byte
,
blklen
)
...
@@ -385,12 +389,12 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) (_ []byte, _ zodb.Tid, err err
...
@@ -385,12 +389,12 @@ func (zb *ZBlk1) loadBlkData(ctx context.Context) (_ []byte, _ zodb.Tid, err err
for
_
,
start
:=
range
offv
[
:
len
(
offv
)
-
1
]
{
for
_
,
start
:=
range
offv
[
:
len
(
offv
)
-
1
]
{
chunk
:=
chunktab
[
start
]
chunk
:=
chunktab
[
start
]
if
!
(
start
>=
stop
)
{
// verify chunks don't overlap
if
!
(
start
>=
stop
)
{
// verify chunks don't overlap
return
nil
,
0
,
fmt
.
Errorf
(
"
!(start >= stop)"
)
// XXX
return
nil
,
0
,
fmt
.
Errorf
(
"
invalid data: chunks overlap"
)
}
}
if
!
(
start
+
int32
(
len
(
chunk
.
data
))
<=
int32
(
len
(
blkdata
)))
{
// XXX overflow?
stop
,
ok
=
overflow
.
Add32
(
start
,
int32
(
len
(
chunk
.
data
)))
return
nil
,
0
,
fmt
.
Errorf
(
"blkdata overrun"
)
// XXX
if
!
(
ok
&&
stop
<=
blklen
)
{
return
nil
,
0
,
fmt
.
Errorf
(
"invalid data: blkdata overrun"
)
}
}
stop
=
start
+
int32
(
len
(
chunk
.
data
))
// XXX overflow?
copy
(
blkdata
[
start
:
],
chunk
.
data
)
copy
(
blkdata
[
start
:
],
chunk
.
data
)
}
}
...
...
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