Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
1f1bf04d
Commit
1f1bf04d
authored
Jan 24, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a37720fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
363 additions
and
888 deletions
+363
-888
t/neo/marshal.go
t/neo/marshal.go
+275
-857
t/neo/protogen.go
t/neo/protogen.go
+88
-31
No files found.
t/neo/marshal.go
View file @
1f1bf04d
...
@@ -26,21 +26,18 @@ func (p *Address) NEOEncode(data []byte) {
...
@@ -26,21 +26,18 @@ func (p *Address) NEOEncode(data []byte) {
func
(
p
*
Address
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Address
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
4
+
l
if
uint32
(
len
(
data
))
<
2
+
l
{
goto
overflow
goto
overflow
}
}
p
.
Host
=
string
(
data
[
:
l
])
p
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
4
+
l
}
if
len
(
data
)
<
2
{
goto
overflow
}
}
p
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
return
2
+
int
(
nread0
),
nil
return
2
+
int
(
nread0
),
nil
...
@@ -72,38 +69,23 @@ func (p *NodeInfo) NEOEncode(data []byte) {
...
@@ -72,38 +69,23 @@ func (p *NodeInfo) NEOEncode(data []byte) {
func
(
p
*
NodeInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NodeInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
p
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
p
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
{
{
if
len
(
data
)
<
8
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
data
=
data
[
8
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
8
+
l
if
uint32
(
len
(
data
))
<
18
+
l
{
goto
overflow
goto
overflow
}
}
p
.
Address
.
Host
=
string
(
data
[
:
l
])
p
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
8
+
l
}
if
len
(
data
)
<
2
{
goto
overflow
}
}
p
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
if
len
(
data
)
<
6
{
goto
overflow
}
p
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])))
p
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])))
if
len
(
data
)
<
10
{
goto
overflow
}
p
.
NodeState
=
NodeState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
6
:
])))
p
.
NodeState
=
NodeState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
6
:
])))
if
len
(
data
)
<
18
{
goto
overflow
}
p
.
IdTimestamp
=
float64_NEODecode
(
data
[
10
:
])
p
.
IdTimestamp
=
float64_NEODecode
(
data
[
10
:
])
return
18
+
int
(
nread0
),
nil
return
18
+
int
(
nread0
),
nil
...
@@ -123,13 +105,10 @@ func (p *CellInfo) NEOEncode(data []byte) {
...
@@ -123,13 +105,10 @@ func (p *CellInfo) NEOEncode(data []byte) {
}
}
func
(
p
*
CellInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CellInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
p
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
p
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
if
len
(
data
)
<
8
{
goto
overflow
}
p
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
p
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
return
8
,
nil
return
8
,
nil
...
@@ -160,27 +139,24 @@ func (p *RowInfo) NEOEncode(data []byte) {
...
@@ -160,27 +139,24 @@ func (p *RowInfo) NEOEncode(data []byte) {
func
(
p
*
RowInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
RowInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
{
if
len
(
data
)
<
8
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
nread0
+=
8
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
CellList
=
make
([]
CellInfo
,
l
)
p
.
CellList
=
make
([]
CellInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
a
:=
&
p
.
CellList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
if
len
(
data
)
<
8
{
goto
overflow
}
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
nread0
+=
8
...
@@ -247,55 +223,49 @@ func (p *XXXTest) NEOEncode(data []byte) {
...
@@ -247,55 +223,49 @@ func (p *XXXTest) NEOEncode(data []byte) {
func
(
p
*
XXXTest
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
XXXTest
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
qqq
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
qqq
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
if
len
(
data
)
<
8
{
goto
overflow
}
p
.
aaa
=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
p
.
aaa
=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
{
{
if
len
(
data
)
<
12
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nread0
+=
12
nread0
+=
12
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
Zzz
=
make
(
map
[
int32
]
map
[
int32
]
string
,
l
)
p
.
Zzz
=
make
(
map
[
int32
]
map
[
int32
]
string
,
l
)
m
:=
p
.
Zzz
m
:=
p
.
Zzz
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
key
:=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
key
:=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
var
v
map
[
int32
]
string
var
v
map
[
int32
]
string
{
{
if
len
(
data
)
<
8
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
nread0
+=
8
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
v
=
make
(
map
[
int32
]
string
,
l
)
v
=
make
(
map
[
int32
]
string
,
l
)
m
:=
v
m
:=
v
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
key
:=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
key
:=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
{
{
if
len
(
data
)
<
8
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
+
l
if
uint32
(
len
(
data
))
<
l
{
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
goto
overflow
}
}
m
[
key
]
=
string
(
data
[
:
l
])
m
[
key
]
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
8
+
l
}
}
data
=
data
[
0
:
]
data
=
data
[
0
:
]
nread0
+=
0
nread0
+=
0
...
@@ -330,18 +300,18 @@ func (p *Notify) NEOEncode(data []byte) {
...
@@ -330,18 +300,18 @@ func (p *Notify) NEOEncode(data []byte) {
func
(
p
*
Notify
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Notify
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
+
l
if
uint32
(
len
(
data
))
<
l
{
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
goto
overflow
}
}
p
.
Message
=
string
(
data
[
:
l
])
p
.
Message
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
4
+
l
}
}
return
0
+
int
(
nread0
),
nil
return
0
+
int
(
nread0
),
nil
...
@@ -368,22 +338,19 @@ func (p *Error) NEOEncode(data []byte) {
...
@@ -368,22 +338,19 @@ func (p *Error) NEOEncode(data []byte) {
func
(
p
*
Error
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Error
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Code
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Code
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
{
if
len
(
data
)
<
8
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
+
l
if
uint32
(
len
(
data
))
<
l
{
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
goto
overflow
}
}
p
.
Message
=
string
(
data
[
:
l
])
p
.
Message
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
8
+
l
}
}
return
0
+
int
(
nread0
),
nil
return
0
+
int
(
nread0
),
nil
...
@@ -447,50 +414,32 @@ func (p *RequestIdentification) NEOEncode(data []byte) {
...
@@ -447,50 +414,32 @@ func (p *RequestIdentification) NEOEncode(data []byte) {
func
(
p
*
RequestIdentification
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
RequestIdentification
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
p
.
ProtocolVersion
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
ProtocolVersion
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
if
len
(
data
)
<
8
{
goto
overflow
}
p
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
p
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
if
len
(
data
)
<
12
{
goto
overflow
}
p
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])))
p
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])))
{
{
if
len
(
data
)
<
16
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
12
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
12
:
])
data
=
data
[
16
:
]
data
=
data
[
16
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
16
+
l
if
uint32
(
len
(
data
))
<
6
+
l
{
goto
overflow
goto
overflow
}
}
p
.
Address
.
Host
=
string
(
data
[
:
l
])
p
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
16
+
l
}
if
len
(
data
)
<
2
{
goto
overflow
}
}
p
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
{
{
if
len
(
data
)
<
6
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])
data
=
data
[
6
:
]
data
=
data
[
6
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
6
+
l
if
uint32
(
len
(
data
))
<
8
+
l
{
goto
overflow
goto
overflow
}
}
p
.
Name
=
string
(
data
[
:
l
])
p
.
Name
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
6
+
l
}
if
len
(
data
)
<
8
{
goto
overflow
}
}
p
.
IdTimestamp
=
float64_NEODecode
(
data
[
0
:
])
p
.
IdTimestamp
=
float64_NEODecode
(
data
[
0
:
])
return
8
+
int
(
nread0
),
nil
return
8
+
int
(
nread0
),
nil
...
@@ -546,76 +495,52 @@ func (p *AcceptIdentification) NEOEncode(data []byte) {
...
@@ -546,76 +495,52 @@ func (p *AcceptIdentification) NEOEncode(data []byte) {
func
(
p
*
AcceptIdentification
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AcceptIdentification
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
2
4
{
goto
overflow
goto
overflow
}
}
p
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
p
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
if
len
(
data
)
<
8
{
goto
overflow
}
p
.
MyUUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
p
.
MyUUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
if
len
(
data
)
<
12
{
goto
overflow
}
p
.
NumPartitions
=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
p
.
NumPartitions
=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
NumReplicas
=
binary
.
BigEndian
.
Uint32
(
data
[
12
:
])
p
.
NumReplicas
=
binary
.
BigEndian
.
Uint32
(
data
[
12
:
])
if
len
(
data
)
<
20
{
goto
overflow
}
p
.
YourUUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
16
:
])))
p
.
YourUUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
16
:
])))
{
{
if
len
(
data
)
<
24
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
20
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
20
:
])
data
=
data
[
24
:
]
data
=
data
[
24
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
24
+
l
if
uint32
(
len
(
data
))
<
6
+
l
{
goto
overflow
goto
overflow
}
}
p
.
Primary
.
Host
=
string
(
data
[
:
l
])
p
.
Primary
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
24
+
l
}
if
len
(
data
)
<
2
{
goto
overflow
}
}
p
.
Primary
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
Primary
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
{
{
if
len
(
data
)
<
6
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])
data
=
data
[
6
:
]
data
=
data
[
6
:
]
nread0
+=
6
nread0
+=
6
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
KnownMasterList
=
make
([]
struct
{
p
.
KnownMasterList
=
make
([]
struct
{
Address
Address
UUID
UUID
UUID
UUID
},
l
)
},
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
KnownMasterList
[
i
]
a
:=
&
p
.
KnownMasterList
[
i
]
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
4
+
l
if
uint32
(
len
(
data
))
<
6
+
l
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
Address
.
Host
=
string
(
data
[
:
l
])
(
*
a
)
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
4
+
l
}
if
len
(
data
)
<
2
{
goto
overflow
}
}
(
*
a
)
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
(
*
a
)
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
if
len
(
data
)
<
6
{
goto
overflow
}
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])))
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])))
data
=
data
[
6
:
]
data
=
data
[
6
:
]
nread0
+=
6
nread0
+=
6
...
@@ -651,7 +576,7 @@ func (p *AnswerPrimary) NEOEncode(data []byte) {
...
@@ -651,7 +576,7 @@ func (p *AnswerPrimary) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerPrimary
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerPrimary
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
)
)
<
4
{
goto
overflow
goto
overflow
}
}
p
.
PrimaryUUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
p
.
PrimaryUUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
...
@@ -713,17 +638,11 @@ func (p *AnswerRecovery) NEOEncode(data []byte) {
...
@@ -713,17 +638,11 @@ func (p *AnswerRecovery) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerRecovery
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerRecovery
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
goto
overflow
}
}
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
BackupTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
BackupTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
if
len
(
data
)
<
24
{
goto
overflow
}
p
.
TruncateTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
p
.
TruncateTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
return
24
,
nil
return
24
,
nil
...
@@ -756,13 +675,10 @@ func (p *AnswerLastIDs) NEOEncode(data []byte) {
...
@@ -756,13 +675,10 @@ func (p *AnswerLastIDs) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerLastIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerLastIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
p
.
LastOID
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
LastOID
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
LastTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
LastTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
return
16
,
nil
return
16
,
nil
...
@@ -821,41 +737,38 @@ func (p *AnswerPartitionTable) NEOEncode(data []byte) {
...
@@ -821,41 +737,38 @@ func (p *AnswerPartitionTable) NEOEncode(data []byte) {
func
(
p
*
AnswerPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
{
{
if
len
(
data
)
<
12
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nread0
+=
12
nread0
+=
12
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
RowList
=
make
([]
RowInfo
,
l
)
p
.
RowList
=
make
([]
RowInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
:=
&
p
.
RowList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
(
*
a
)
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
{
if
len
(
data
)
<
8
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
nread0
+=
8
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
(
*
a
)
.
CellList
=
make
([]
CellInfo
,
l
)
(
*
a
)
.
CellList
=
make
([]
CellInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
a
:=
&
(
*
a
)
.
CellList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
if
len
(
data
)
<
8
{
goto
overflow
}
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
nread0
+=
8
...
@@ -909,41 +822,38 @@ func (p *NotifyPartitionTable) NEOEncode(data []byte) {
...
@@ -909,41 +822,38 @@ func (p *NotifyPartitionTable) NEOEncode(data []byte) {
func
(
p
*
NotifyPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotifyPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
{
{
if
len
(
data
)
<
12
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nread0
+=
12
nread0
+=
12
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
RowList
=
make
([]
RowInfo
,
l
)
p
.
RowList
=
make
([]
RowInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
:=
&
p
.
RowList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
(
*
a
)
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
{
if
len
(
data
)
<
8
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
nread0
+=
8
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
(
*
a
)
.
CellList
=
make
([]
CellInfo
,
l
)
(
*
a
)
.
CellList
=
make
([]
CellInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
a
:=
&
(
*
a
)
.
CellList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
if
len
(
data
)
<
8
{
goto
overflow
}
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
nread0
+=
8
...
@@ -983,17 +893,17 @@ func (p *PartitionChanges) NEOEncode(data []byte) {
...
@@ -983,17 +893,17 @@ func (p *PartitionChanges) NEOEncode(data []byte) {
func
(
p
*
PartitionChanges
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
PartitionChanges
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
{
{
if
len
(
data
)
<
12
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nread0
+=
12
nread0
+=
12
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
CellList
=
make
([]
struct
{
p
.
CellList
=
make
([]
struct
{
Offset
uint32
Offset
uint32
UUID
UUID
UUID
UUID
...
@@ -1001,17 +911,11 @@ func (p *PartitionChanges) NEODecode(data []byte) (int, error) {
...
@@ -1001,17 +911,11 @@ func (p *PartitionChanges) NEODecode(data []byte) (int, error) {
},
l
)
},
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
a
:=
&
p
.
CellList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
(
*
a
)
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
if
len
(
data
)
<
8
{
goto
overflow
}
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
if
len
(
data
)
<
12
{
goto
overflow
}
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])))
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])))
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nread0
+=
12
nread0
+=
12
...
@@ -1034,7 +938,7 @@ func (p *StartOperation) NEOEncode(data []byte) {
...
@@ -1034,7 +938,7 @@ func (p *StartOperation) NEOEncode(data []byte) {
}
}
func
(
p
*
StartOperation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
StartOperation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
1
{
if
uint32
(
len
(
data
)
)
<
1
{
goto
overflow
goto
overflow
}
}
p
.
Backup
=
byte2bool
((
data
[
0
:
])[
0
])
p
.
Backup
=
byte2bool
((
data
[
0
:
])[
0
])
...
@@ -1092,21 +996,21 @@ func (p *AnswerUnfinishedTransactions) NEOEncode(data []byte) {
...
@@ -1092,21 +996,21 @@ func (p *AnswerUnfinishedTransactions) NEOEncode(data []byte) {
func
(
p
*
AnswerUnfinishedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerUnfinishedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
{
{
if
len
(
data
)
<
12
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nread0
+=
12
nread0
+=
12
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
TidList
=
make
([]
struct
{
UnfinishedTID
Tid
},
l
)
p
.
TidList
=
make
([]
struct
{
UnfinishedTID
Tid
},
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TidList
[
i
]
a
:=
&
p
.
TidList
[
i
]
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
UnfinishedTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
(
*
a
)
.
UnfinishedTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1159,23 +1063,23 @@ func (p *AnswerLockedTransactions) NEOEncode(data []byte) {
...
@@ -1159,23 +1063,23 @@ func (p *AnswerLockedTransactions) NEOEncode(data []byte) {
func
(
p
*
AnswerLockedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerLockedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
nread0
+=
4
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
TidDict
=
make
(
map
[
Tid
]
Tid
,
l
)
p
.
TidDict
=
make
(
map
[
Tid
]
Tid
,
l
)
m
:=
p
.
TidDict
m
:=
p
.
TidDict
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
key
:=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
key
:=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
m
[
key
]
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
m
[
key
]
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
data
=
data
[
16
:
]
data
=
data
[
16
:
]
nread0
+=
16
nread0
+=
16
...
@@ -1198,7 +1102,7 @@ func (p *FinalTID) NEOEncode(data []byte) {
...
@@ -1198,7 +1102,7 @@ func (p *FinalTID) NEOEncode(data []byte) {
}
}
func
(
p
*
FinalTID
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
FinalTID
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1219,7 +1123,7 @@ func (p *AnswerFinalTID) NEOEncode(data []byte) {
...
@@ -1219,7 +1123,7 @@ func (p *AnswerFinalTID) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerFinalTID
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerFinalTID
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1241,13 +1145,10 @@ func (p *ValidateTransaction) NEOEncode(data []byte) {
...
@@ -1241,13 +1145,10 @@ func (p *ValidateTransaction) NEOEncode(data []byte) {
}
}
func
(
p
*
ValidateTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
ValidateTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
return
16
,
nil
return
16
,
nil
...
@@ -1266,7 +1167,7 @@ func (p *BeginTransaction) NEOEncode(data []byte) {
...
@@ -1266,7 +1167,7 @@ func (p *BeginTransaction) NEOEncode(data []byte) {
}
}
func
(
p
*
BeginTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
BeginTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1287,7 +1188,7 @@ func (p *AnswerBeginTransaction) NEOEncode(data []byte) {
...
@@ -1287,7 +1188,7 @@ func (p *AnswerBeginTransaction) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerBeginTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerBeginTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1329,39 +1230,42 @@ func (p *FinishTransaction) NEOEncode(data []byte) {
...
@@ -1329,39 +1230,42 @@ func (p *FinishTransaction) NEOEncode(data []byte) {
func
(
p
*
FinishTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
FinishTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
{
{
if
len
(
data
)
<
12
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nread0
+=
12
nread0
+=
12
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
OIDList
=
make
([]
Oid
,
l
)
p
.
OIDList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OIDList
[
i
]
a
:=
&
p
.
OIDList
[
i
]
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
nread0
+=
8
}
}
}
if
uint32
(
len
(
data
))
<
4
{
{
if
len
(
data
)
<
4
{
goto
overflow
goto
overflow
}
}
}
{
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
nread0
+=
4
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
CheckedList
=
make
([]
Oid
,
l
)
p
.
CheckedList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CheckedList
[
i
]
a
:=
&
p
.
CheckedList
[
i
]
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1387,13 +1291,10 @@ func (p *AnswerFinishTransaction) NEOEncode(data []byte) {
...
@@ -1387,13 +1291,10 @@ func (p *AnswerFinishTransaction) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerFinishTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerFinishTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
return
16
,
nil
return
16
,
nil
...
@@ -1413,13 +1314,10 @@ func (p *NotifyTransactionFinished) NEOEncode(data []byte) {
...
@@ -1413,13 +1314,10 @@ func (p *NotifyTransactionFinished) NEOEncode(data []byte) {
}
}
func
(
p
*
NotifyTransactionFinished
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotifyTransactionFinished
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
return
16
,
nil
return
16
,
nil
...
@@ -1439,13 +1337,10 @@ func (p *LockInformation) NEOEncode(data []byte) {
...
@@ -1439,13 +1337,10 @@ func (p *LockInformation) NEOEncode(data []byte) {
}
}
func
(
p
*
LockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
LockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
p
.
Ttid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Ttid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
return
16
,
nil
return
16
,
nil
...
@@ -1464,7 +1359,7 @@ func (p *AnswerLockInformation) NEOEncode(data []byte) {
...
@@ -1464,7 +1359,7 @@ func (p *AnswerLockInformation) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerLockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerLockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Ttid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Ttid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1496,21 +1391,21 @@ func (p *InvalidateObjects) NEOEncode(data []byte) {
...
@@ -1496,21 +1391,21 @@ func (p *InvalidateObjects) NEOEncode(data []byte) {
func
(
p
*
InvalidateObjects
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
InvalidateObjects
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
{
{
if
len
(
data
)
<
12
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nread0
+=
12
nread0
+=
12
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
OidList
=
make
([]
Oid
,
l
)
p
.
OidList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
:=
&
p
.
OidList
[
i
]
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1535,7 +1430,7 @@ func (p *UnlockInformation) NEOEncode(data []byte) {
...
@@ -1535,7 +1430,7 @@ func (p *UnlockInformation) NEOEncode(data []byte) {
}
}
func
(
p
*
UnlockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
UnlockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1556,7 +1451,7 @@ func (p *GenerateOIDs) NEOEncode(data []byte) {
...
@@ -1556,7 +1451,7 @@ func (p *GenerateOIDs) NEOEncode(data []byte) {
}
}
func
(
p
*
GenerateOIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
GenerateOIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
)
)
<
4
{
goto
overflow
goto
overflow
}
}
p
.
NumOIDs
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
NumOIDs
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
...
@@ -1587,17 +1482,20 @@ func (p *AnswerGenerateOIDs) NEOEncode(data []byte) {
...
@@ -1587,17 +1482,20 @@ func (p *AnswerGenerateOIDs) NEOEncode(data []byte) {
func
(
p
*
AnswerGenerateOIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerGenerateOIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
nread0
+=
4
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
OidList
=
make
([]
Oid
,
l
)
p
.
OidList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
:=
&
p
.
OidList
[
i
]
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1658,127 +1556,55 @@ func (p *StoreObject) NEOEncode(data []byte) {
...
@@ -1658,127 +1556,55 @@ func (p *StoreObject) NEOEncode(data []byte) {
func
(
p
*
StoreObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
StoreObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
41
{
goto
overflow
goto
overflow
}
}
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
if
len
(
data
)
<
17
{
goto
overflow
}
p
.
Compression
=
byte2bool
((
data
[
16
:
])[
0
])
p
.
Compression
=
byte2bool
((
data
[
16
:
])[
0
])
if
len
(
data
)
<
18
{
goto
overflow
}
p
.
Checksum
[
0
]
=
(
data
[
17
:
])[
0
]
p
.
Checksum
[
0
]
=
(
data
[
17
:
])[
0
]
if
len
(
data
)
<
19
{
goto
overflow
}
p
.
Checksum
[
1
]
=
(
data
[
18
:
])[
0
]
p
.
Checksum
[
1
]
=
(
data
[
18
:
])[
0
]
if
len
(
data
)
<
20
{
goto
overflow
}
p
.
Checksum
[
2
]
=
(
data
[
19
:
])[
0
]
p
.
Checksum
[
2
]
=
(
data
[
19
:
])[
0
]
if
len
(
data
)
<
21
{
goto
overflow
}
p
.
Checksum
[
3
]
=
(
data
[
20
:
])[
0
]
p
.
Checksum
[
3
]
=
(
data
[
20
:
])[
0
]
if
len
(
data
)
<
22
{
goto
overflow
}
p
.
Checksum
[
4
]
=
(
data
[
21
:
])[
0
]
p
.
Checksum
[
4
]
=
(
data
[
21
:
])[
0
]
if
len
(
data
)
<
23
{
goto
overflow
}
p
.
Checksum
[
5
]
=
(
data
[
22
:
])[
0
]
p
.
Checksum
[
5
]
=
(
data
[
22
:
])[
0
]
if
len
(
data
)
<
24
{
goto
overflow
}
p
.
Checksum
[
6
]
=
(
data
[
23
:
])[
0
]
p
.
Checksum
[
6
]
=
(
data
[
23
:
])[
0
]
if
len
(
data
)
<
25
{
goto
overflow
}
p
.
Checksum
[
7
]
=
(
data
[
24
:
])[
0
]
p
.
Checksum
[
7
]
=
(
data
[
24
:
])[
0
]
if
len
(
data
)
<
26
{
goto
overflow
}
p
.
Checksum
[
8
]
=
(
data
[
25
:
])[
0
]
p
.
Checksum
[
8
]
=
(
data
[
25
:
])[
0
]
if
len
(
data
)
<
27
{
goto
overflow
}
p
.
Checksum
[
9
]
=
(
data
[
26
:
])[
0
]
p
.
Checksum
[
9
]
=
(
data
[
26
:
])[
0
]
if
len
(
data
)
<
28
{
goto
overflow
}
p
.
Checksum
[
10
]
=
(
data
[
27
:
])[
0
]
p
.
Checksum
[
10
]
=
(
data
[
27
:
])[
0
]
if
len
(
data
)
<
29
{
goto
overflow
}
p
.
Checksum
[
11
]
=
(
data
[
28
:
])[
0
]
p
.
Checksum
[
11
]
=
(
data
[
28
:
])[
0
]
if
len
(
data
)
<
30
{
goto
overflow
}
p
.
Checksum
[
12
]
=
(
data
[
29
:
])[
0
]
p
.
Checksum
[
12
]
=
(
data
[
29
:
])[
0
]
if
len
(
data
)
<
31
{
goto
overflow
}
p
.
Checksum
[
13
]
=
(
data
[
30
:
])[
0
]
p
.
Checksum
[
13
]
=
(
data
[
30
:
])[
0
]
if
len
(
data
)
<
32
{
goto
overflow
}
p
.
Checksum
[
14
]
=
(
data
[
31
:
])[
0
]
p
.
Checksum
[
14
]
=
(
data
[
31
:
])[
0
]
if
len
(
data
)
<
33
{
goto
overflow
}
p
.
Checksum
[
15
]
=
(
data
[
32
:
])[
0
]
p
.
Checksum
[
15
]
=
(
data
[
32
:
])[
0
]
if
len
(
data
)
<
34
{
goto
overflow
}
p
.
Checksum
[
16
]
=
(
data
[
33
:
])[
0
]
p
.
Checksum
[
16
]
=
(
data
[
33
:
])[
0
]
if
len
(
data
)
<
35
{
goto
overflow
}
p
.
Checksum
[
17
]
=
(
data
[
34
:
])[
0
]
p
.
Checksum
[
17
]
=
(
data
[
34
:
])[
0
]
if
len
(
data
)
<
36
{
goto
overflow
}
p
.
Checksum
[
18
]
=
(
data
[
35
:
])[
0
]
p
.
Checksum
[
18
]
=
(
data
[
35
:
])[
0
]
if
len
(
data
)
<
37
{
goto
overflow
}
p
.
Checksum
[
19
]
=
(
data
[
36
:
])[
0
]
p
.
Checksum
[
19
]
=
(
data
[
36
:
])[
0
]
{
{
if
len
(
data
)
<
41
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
37
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
37
:
])
data
=
data
[
41
:
]
data
=
data
[
41
:
]
nread0
+=
41
nread0
+=
41
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
Data
=
make
([]
byte
,
l
)
p
.
Data
=
make
([]
byte
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
Data
[
i
]
a
:=
&
p
.
Data
[
i
]
if
len
(
data
)
<
1
{
if
uint32
(
len
(
data
)
)
<
1
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
(
data
[
0
:
])[
0
]
(
*
a
)
=
(
data
[
0
:
])[
0
]
data
=
data
[
1
:
]
data
=
data
[
1
:
]
nread0
+=
1
nread0
+=
1
}
}
}
if
uint32
(
len
(
data
))
<
17
{
if
len
(
data
)
<
8
{
goto
overflow
goto
overflow
}
}
}
p
.
DataSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
DataSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
if
len
(
data
)
<
17
{
goto
overflow
}
p
.
Unlock
=
byte2bool
((
data
[
16
:
])[
0
])
p
.
Unlock
=
byte2bool
((
data
[
16
:
])[
0
])
return
17
+
int
(
nread0
),
nil
return
17
+
int
(
nread0
),
nil
...
@@ -1799,17 +1625,11 @@ func (p *AnswerStoreObject) NEOEncode(data []byte) {
...
@@ -1799,17 +1625,11 @@ func (p *AnswerStoreObject) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerStoreObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerStoreObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
1
{
if
uint32
(
len
(
data
))
<
17
{
goto
overflow
goto
overflow
}
}
p
.
Conflicting
=
byte2bool
((
data
[
0
:
])[
0
])
p
.
Conflicting
=
byte2bool
((
data
[
0
:
])[
0
])
if
len
(
data
)
<
9
{
goto
overflow
}
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
1
:
]))
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
1
:
]))
if
len
(
data
)
<
17
{
goto
overflow
}
p
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
9
:
]))
p
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
9
:
]))
return
17
,
nil
return
17
,
nil
...
@@ -1828,7 +1648,7 @@ func (p *AbortTransaction) NEOEncode(data []byte) {
...
@@ -1828,7 +1648,7 @@ func (p *AbortTransaction) NEOEncode(data []byte) {
}
}
func
(
p
*
AbortTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AbortTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1881,60 +1701,51 @@ func (p *StoreTransaction) NEOEncode(data []byte) {
...
@@ -1881,60 +1701,51 @@ func (p *StoreTransaction) NEOEncode(data []byte) {
func
(
p
*
StoreTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
StoreTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
{
{
if
len
(
data
)
<
12
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
data
=
data
[
12
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
12
+
l
if
uint32
(
len
(
data
))
<
4
+
l
{
goto
overflow
goto
overflow
}
}
p
.
User
=
string
(
data
[
:
l
])
p
.
User
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
12
+
l
}
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
4
+
l
if
uint32
(
len
(
data
))
<
4
+
l
{
goto
overflow
goto
overflow
}
}
p
.
Description
=
string
(
data
[
:
l
])
p
.
Description
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
4
+
l
}
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
4
+
l
if
uint32
(
len
(
data
))
<
4
+
l
{
goto
overflow
goto
overflow
}
}
p
.
Extension
=
string
(
data
[
:
l
])
p
.
Extension
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
4
+
l
}
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
nread0
+=
4
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
OidList
=
make
([]
Oid
,
l
)
p
.
OidList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
:=
&
p
.
OidList
[
i
]
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1959,7 +1770,7 @@ func (p *VoteTransaction) NEOEncode(data []byte) {
...
@@ -1959,7 +1770,7 @@ func (p *VoteTransaction) NEOEncode(data []byte) {
}
}
func
(
p
*
VoteTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
VoteTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -1982,17 +1793,11 @@ func (p *GetObject) NEOEncode(data []byte) {
...
@@ -1982,17 +1793,11 @@ func (p *GetObject) NEOEncode(data []byte) {
}
}
func
(
p
*
GetObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
GetObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
goto
overflow
}
}
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
if
len
(
data
)
<
24
{
goto
overflow
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
return
24
,
nil
return
24
,
nil
...
@@ -2046,122 +1851,53 @@ func (p *AnswerGetObject) NEOEncode(data []byte) {
...
@@ -2046,122 +1851,53 @@ func (p *AnswerGetObject) NEOEncode(data []byte) {
func
(
p
*
AnswerGetObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerGetObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
49
{
goto
overflow
goto
overflow
}
}
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
SerialStart
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
SerialStart
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
if
len
(
data
)
<
24
{
goto
overflow
}
p
.
SerialEnd
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
p
.
SerialEnd
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
if
len
(
data
)
<
25
{
goto
overflow
}
p
.
Compression
=
byte2bool
((
data
[
24
:
])[
0
])
p
.
Compression
=
byte2bool
((
data
[
24
:
])[
0
])
if
len
(
data
)
<
26
{
goto
overflow
}
p
.
Checksum
[
0
]
=
(
data
[
25
:
])[
0
]
p
.
Checksum
[
0
]
=
(
data
[
25
:
])[
0
]
if
len
(
data
)
<
27
{
goto
overflow
}
p
.
Checksum
[
1
]
=
(
data
[
26
:
])[
0
]
p
.
Checksum
[
1
]
=
(
data
[
26
:
])[
0
]
if
len
(
data
)
<
28
{
goto
overflow
}
p
.
Checksum
[
2
]
=
(
data
[
27
:
])[
0
]
p
.
Checksum
[
2
]
=
(
data
[
27
:
])[
0
]
if
len
(
data
)
<
29
{
goto
overflow
}
p
.
Checksum
[
3
]
=
(
data
[
28
:
])[
0
]
p
.
Checksum
[
3
]
=
(
data
[
28
:
])[
0
]
if
len
(
data
)
<
30
{
goto
overflow
}
p
.
Checksum
[
4
]
=
(
data
[
29
:
])[
0
]
p
.
Checksum
[
4
]
=
(
data
[
29
:
])[
0
]
if
len
(
data
)
<
31
{
goto
overflow
}
p
.
Checksum
[
5
]
=
(
data
[
30
:
])[
0
]
p
.
Checksum
[
5
]
=
(
data
[
30
:
])[
0
]
if
len
(
data
)
<
32
{
goto
overflow
}
p
.
Checksum
[
6
]
=
(
data
[
31
:
])[
0
]
p
.
Checksum
[
6
]
=
(
data
[
31
:
])[
0
]
if
len
(
data
)
<
33
{
goto
overflow
}
p
.
Checksum
[
7
]
=
(
data
[
32
:
])[
0
]
p
.
Checksum
[
7
]
=
(
data
[
32
:
])[
0
]
if
len
(
data
)
<
34
{
goto
overflow
}
p
.
Checksum
[
8
]
=
(
data
[
33
:
])[
0
]
p
.
Checksum
[
8
]
=
(
data
[
33
:
])[
0
]
if
len
(
data
)
<
35
{
goto
overflow
}
p
.
Checksum
[
9
]
=
(
data
[
34
:
])[
0
]
p
.
Checksum
[
9
]
=
(
data
[
34
:
])[
0
]
if
len
(
data
)
<
36
{
goto
overflow
}
p
.
Checksum
[
10
]
=
(
data
[
35
:
])[
0
]
p
.
Checksum
[
10
]
=
(
data
[
35
:
])[
0
]
if
len
(
data
)
<
37
{
goto
overflow
}
p
.
Checksum
[
11
]
=
(
data
[
36
:
])[
0
]
p
.
Checksum
[
11
]
=
(
data
[
36
:
])[
0
]
if
len
(
data
)
<
38
{
goto
overflow
}
p
.
Checksum
[
12
]
=
(
data
[
37
:
])[
0
]
p
.
Checksum
[
12
]
=
(
data
[
37
:
])[
0
]
if
len
(
data
)
<
39
{
goto
overflow
}
p
.
Checksum
[
13
]
=
(
data
[
38
:
])[
0
]
p
.
Checksum
[
13
]
=
(
data
[
38
:
])[
0
]
if
len
(
data
)
<
40
{
goto
overflow
}
p
.
Checksum
[
14
]
=
(
data
[
39
:
])[
0
]
p
.
Checksum
[
14
]
=
(
data
[
39
:
])[
0
]
if
len
(
data
)
<
41
{
goto
overflow
}
p
.
Checksum
[
15
]
=
(
data
[
40
:
])[
0
]
p
.
Checksum
[
15
]
=
(
data
[
40
:
])[
0
]
if
len
(
data
)
<
42
{
goto
overflow
}
p
.
Checksum
[
16
]
=
(
data
[
41
:
])[
0
]
p
.
Checksum
[
16
]
=
(
data
[
41
:
])[
0
]
if
len
(
data
)
<
43
{
goto
overflow
}
p
.
Checksum
[
17
]
=
(
data
[
42
:
])[
0
]
p
.
Checksum
[
17
]
=
(
data
[
42
:
])[
0
]
if
len
(
data
)
<
44
{
goto
overflow
}
p
.
Checksum
[
18
]
=
(
data
[
43
:
])[
0
]
p
.
Checksum
[
18
]
=
(
data
[
43
:
])[
0
]
if
len
(
data
)
<
45
{
goto
overflow
}
p
.
Checksum
[
19
]
=
(
data
[
44
:
])[
0
]
p
.
Checksum
[
19
]
=
(
data
[
44
:
])[
0
]
{
{
if
len
(
data
)
<
49
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
45
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
45
:
])
data
=
data
[
49
:
]
data
=
data
[
49
:
]
nread0
+=
49
nread0
+=
49
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
Data
=
make
([]
byte
,
l
)
p
.
Data
=
make
([]
byte
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
Data
[
i
]
a
:=
&
p
.
Data
[
i
]
if
len
(
data
)
<
1
{
if
uint32
(
len
(
data
)
)
<
1
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
(
data
[
0
:
])[
0
]
(
*
a
)
=
(
data
[
0
:
])[
0
]
data
=
data
[
1
:
]
data
=
data
[
1
:
]
nread0
+=
1
nread0
+=
1
}
}
}
if
uint32
(
len
(
data
))
<
8
{
if
len
(
data
)
<
8
{
goto
overflow
goto
overflow
}
}
}
p
.
DataSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
DataSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
8
+
int
(
nread0
),
nil
return
8
+
int
(
nread0
),
nil
...
@@ -2183,17 +1919,11 @@ func (p *TIDList) NEOEncode(data []byte) {
...
@@ -2183,17 +1919,11 @@ func (p *TIDList) NEOEncode(data []byte) {
}
}
func
(
p
*
TIDList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
TIDList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
20
{
goto
overflow
goto
overflow
}
}
p
.
First
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
First
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
Last
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Last
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
if
len
(
data
)
<
20
{
goto
overflow
}
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
16
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
16
:
])
return
20
,
nil
return
20
,
nil
...
@@ -2222,17 +1952,20 @@ func (p *AnswerTIDList) NEOEncode(data []byte) {
...
@@ -2222,17 +1952,20 @@ func (p *AnswerTIDList) NEOEncode(data []byte) {
func
(
p
*
AnswerTIDList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerTIDList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
nread0
+=
4
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
TIDList
=
make
([]
Tid
,
l
)
p
.
TIDList
=
make
([]
Tid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TIDList
[
i
]
a
:=
&
p
.
TIDList
[
i
]
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
(
*
a
)
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -2260,21 +1993,12 @@ func (p *TIDListFrom) NEOEncode(data []byte) {
...
@@ -2260,21 +1993,12 @@ func (p *TIDListFrom) NEOEncode(data []byte) {
}
}
func
(
p
*
TIDListFrom
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
TIDListFrom
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
goto
overflow
}
}
p
.
MinTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
MinTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
if
len
(
data
)
<
20
{
goto
overflow
}
p
.
Length
=
binary
.
BigEndian
.
Uint32
(
data
[
16
:
])
p
.
Length
=
binary
.
BigEndian
.
Uint32
(
data
[
16
:
])
if
len
(
data
)
<
24
{
goto
overflow
}
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
20
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
20
:
])
return
24
,
nil
return
24
,
nil
...
@@ -2303,17 +2027,20 @@ func (p *AnswerTIDListFrom) NEOEncode(data []byte) {
...
@@ -2303,17 +2027,20 @@ func (p *AnswerTIDListFrom) NEOEncode(data []byte) {
func
(
p
*
AnswerTIDListFrom
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerTIDListFrom
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
nread0
+=
4
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
TidList
=
make
([]
Tid
,
l
)
p
.
TidList
=
make
([]
Tid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TidList
[
i
]
a
:=
&
p
.
TidList
[
i
]
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
(
*
a
)
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -2338,7 +2065,7 @@ func (p *TransactionInformation) NEOEncode(data []byte) {
...
@@ -2338,7 +2065,7 @@ func (p *TransactionInformation) NEOEncode(data []byte) {
}
}
func
(
p
*
TransactionInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
TransactionInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -2392,64 +2119,52 @@ func (p *AnswerTransactionInformation) NEOEncode(data []byte) {
...
@@ -2392,64 +2119,52 @@ func (p *AnswerTransactionInformation) NEOEncode(data []byte) {
func
(
p
*
AnswerTransactionInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerTransactionInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
{
{
if
len
(
data
)
<
12
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
data
=
data
[
12
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
12
+
l
if
uint32
(
len
(
data
))
<
4
+
l
{
goto
overflow
goto
overflow
}
}
p
.
User
=
string
(
data
[
:
l
])
p
.
User
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
12
+
l
}
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
4
+
l
if
uint32
(
len
(
data
))
<
4
+
l
{
goto
overflow
goto
overflow
}
}
p
.
Description
=
string
(
data
[
:
l
])
p
.
Description
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
4
+
l
}
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
4
+
l
if
uint32
(
len
(
data
))
<
5
+
l
{
goto
overflow
goto
overflow
}
}
p
.
Extension
=
string
(
data
[
:
l
])
p
.
Extension
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
4
+
l
}
if
len
(
data
)
<
1
{
goto
overflow
}
}
p
.
Packed
=
byte2bool
((
data
[
0
:
])[
0
])
p
.
Packed
=
byte2bool
((
data
[
0
:
])[
0
])
{
{
if
len
(
data
)
<
5
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
1
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
1
:
])
data
=
data
[
5
:
]
data
=
data
[
5
:
]
nread0
+=
5
nread0
+=
5
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
OidList
=
make
([]
Oid
,
l
)
p
.
OidList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
:=
&
p
.
OidList
[
i
]
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -2476,17 +2191,11 @@ func (p *ObjectHistory) NEOEncode(data []byte) {
...
@@ -2476,17 +2191,11 @@ func (p *ObjectHistory) NEOEncode(data []byte) {
}
}
func
(
p
*
ObjectHistory
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
ObjectHistory
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
goto
overflow
}
}
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
First
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
First
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
if
len
(
data
)
<
24
{
goto
overflow
}
p
.
Last
=
binary
.
BigEndian
.
Uint64
(
data
[
16
:
])
p
.
Last
=
binary
.
BigEndian
.
Uint64
(
data
[
16
:
])
return
24
,
nil
return
24
,
nil
...
@@ -2517,30 +2226,27 @@ func (p *AnswerObjectHistory) NEOEncode(data []byte) {
...
@@ -2517,30 +2226,27 @@ func (p *AnswerObjectHistory) NEOEncode(data []byte) {
func
(
p
*
AnswerObjectHistory
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerObjectHistory
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
{
{
if
len
(
data
)
<
12
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nread0
+=
12
nread0
+=
12
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
HistoryList
=
make
([]
struct
{
p
.
HistoryList
=
make
([]
struct
{
Serial
Tid
Serial
Tid
Size
uint32
Size
uint32
},
l
)
},
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
HistoryList
[
i
]
a
:=
&
p
.
HistoryList
[
i
]
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
(
*
a
)
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
12
{
goto
overflow
}
(
*
a
)
.
Size
=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
(
*
a
)
.
Size
=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nread0
+=
12
nread0
+=
12
...
@@ -2565,17 +2271,11 @@ func (p *PartitionList) NEOEncode(data []byte) {
...
@@ -2565,17 +2271,11 @@ func (p *PartitionList) NEOEncode(data []byte) {
}
}
func
(
p
*
PartitionList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
PartitionList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
MinOffset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
MinOffset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
if
len
(
data
)
<
8
{
goto
overflow
}
p
.
MaxOffset
=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
p
.
MaxOffset
=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
if
len
(
data
)
<
12
{
goto
overflow
}
p
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])))
p
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])))
return
12
,
nil
return
12
,
nil
...
@@ -2621,41 +2321,38 @@ func (p *AnswerPartitionList) NEOEncode(data []byte) {
...
@@ -2621,41 +2321,38 @@ func (p *AnswerPartitionList) NEOEncode(data []byte) {
func
(
p
*
AnswerPartitionList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerPartitionList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
{
{
if
len
(
data
)
<
12
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
data
=
data
[
12
:
]
nread0
+=
12
nread0
+=
12
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
RowList
=
make
([]
RowInfo
,
l
)
p
.
RowList
=
make
([]
RowInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
:=
&
p
.
RowList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
(
*
a
)
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
{
if
len
(
data
)
<
8
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
nread0
+=
8
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
(
*
a
)
.
CellList
=
make
([]
CellInfo
,
l
)
(
*
a
)
.
CellList
=
make
([]
CellInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
a
:=
&
(
*
a
)
.
CellList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
if
len
(
data
)
<
8
{
goto
overflow
}
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
nread0
+=
8
...
@@ -2682,7 +2379,7 @@ func (p *X_NodeList) NEOEncode(data []byte) {
...
@@ -2682,7 +2379,7 @@ func (p *X_NodeList) NEOEncode(data []byte) {
}
}
func
(
p
*
X_NodeList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
X_NodeList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
)
)
<
4
{
goto
overflow
goto
overflow
}
}
p
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
p
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
...
@@ -2729,48 +2426,36 @@ func (p *AnswerNodeList) NEOEncode(data []byte) {
...
@@ -2729,48 +2426,36 @@ func (p *AnswerNodeList) NEOEncode(data []byte) {
func
(
p
*
AnswerNodeList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerNodeList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
nread0
+=
4
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
NodeList
=
make
([]
NodeInfo
,
l
)
p
.
NodeList
=
make
([]
NodeInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
NodeList
[
i
]
a
:=
&
p
.
NodeList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
{
{
if
len
(
data
)
<
8
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
data
=
data
[
8
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
8
+
l
if
uint32
(
len
(
data
))
<
18
+
l
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
Address
.
Host
=
string
(
data
[
:
l
])
(
*
a
)
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
8
+
l
}
if
len
(
data
)
<
2
{
goto
overflow
}
}
(
*
a
)
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
(
*
a
)
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
if
len
(
data
)
<
6
{
goto
overflow
}
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])))
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])))
if
len
(
data
)
<
10
{
goto
overflow
}
(
*
a
)
.
NodeState
=
NodeState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
6
:
])))
(
*
a
)
.
NodeState
=
NodeState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
6
:
])))
if
len
(
data
)
<
18
{
goto
overflow
}
(
*
a
)
.
IdTimestamp
=
float64_NEODecode
(
data
[
10
:
])
(
*
a
)
.
IdTimestamp
=
float64_NEODecode
(
data
[
10
:
])
data
=
data
[
18
:
]
data
=
data
[
18
:
]
nread0
+=
18
nread0
+=
18
...
@@ -2794,13 +2479,10 @@ func (p *SetNodeState) NEOEncode(data []byte) {
...
@@ -2794,13 +2479,10 @@ func (p *SetNodeState) NEOEncode(data []byte) {
}
}
func
(
p
*
SetNodeState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
SetNodeState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
p
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
p
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
if
len
(
data
)
<
8
{
goto
overflow
}
p
.
NodeState
=
NodeState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
p
.
NodeState
=
NodeState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
return
8
,
nil
return
8
,
nil
...
@@ -2829,17 +2511,20 @@ func (p *AddPendingNodes) NEOEncode(data []byte) {
...
@@ -2829,17 +2511,20 @@ func (p *AddPendingNodes) NEOEncode(data []byte) {
func
(
p
*
AddPendingNodes
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AddPendingNodes
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
nread0
+=
4
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
UUIDList
=
make
([]
UUID
,
l
)
p
.
UUIDList
=
make
([]
UUID
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
UUIDList
[
i
]
a
:=
&
p
.
UUIDList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
)
)
<
4
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
...
@@ -2874,17 +2559,20 @@ func (p *TweakPartitionTable) NEOEncode(data []byte) {
...
@@ -2874,17 +2559,20 @@ func (p *TweakPartitionTable) NEOEncode(data []byte) {
func
(
p
*
TweakPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
TweakPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
nread0
+=
4
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
UUIDList
=
make
([]
UUID
,
l
)
p
.
UUIDList
=
make
([]
UUID
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
UUIDList
[
i
]
a
:=
&
p
.
UUIDList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
)
)
<
4
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
...
@@ -2935,48 +2623,36 @@ func (p *NotifyNodeInformation) NEOEncode(data []byte) {
...
@@ -2935,48 +2623,36 @@ func (p *NotifyNodeInformation) NEOEncode(data []byte) {
func
(
p
*
NotifyNodeInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotifyNodeInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
nread0
+=
4
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
NodeList
=
make
([]
NodeInfo
,
l
)
p
.
NodeList
=
make
([]
NodeInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
NodeList
[
i
]
a
:=
&
p
.
NodeList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
{
{
if
len
(
data
)
<
8
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
data
=
data
[
8
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
8
+
l
if
uint32
(
len
(
data
))
<
18
+
l
{
goto
overflow
goto
overflow
}
}
(
*
a
)
.
Address
.
Host
=
string
(
data
[
:
l
])
(
*
a
)
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
8
+
l
}
if
len
(
data
)
<
2
{
goto
overflow
}
}
(
*
a
)
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
(
*
a
)
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
if
len
(
data
)
<
6
{
goto
overflow
}
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])))
(
*
a
)
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])))
if
len
(
data
)
<
10
{
goto
overflow
}
(
*
a
)
.
NodeState
=
NodeState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
6
:
])))
(
*
a
)
.
NodeState
=
NodeState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
6
:
])))
if
len
(
data
)
<
18
{
goto
overflow
}
(
*
a
)
.
IdTimestamp
=
float64_NEODecode
(
data
[
10
:
])
(
*
a
)
.
IdTimestamp
=
float64_NEODecode
(
data
[
10
:
])
data
=
data
[
18
:
]
data
=
data
[
18
:
]
nread0
+=
18
nread0
+=
18
...
@@ -3012,7 +2688,7 @@ func (p *SetClusterState) NEOEncode(data []byte) {
...
@@ -3012,7 +2688,7 @@ func (p *SetClusterState) NEOEncode(data []byte) {
}
}
func
(
p
*
SetClusterState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
SetClusterState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
)
)
<
4
{
goto
overflow
goto
overflow
}
}
p
.
State
=
ClusterState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
p
.
State
=
ClusterState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
...
@@ -3033,7 +2709,7 @@ func (p *ClusterInformation) NEOEncode(data []byte) {
...
@@ -3033,7 +2709,7 @@ func (p *ClusterInformation) NEOEncode(data []byte) {
}
}
func
(
p
*
ClusterInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
ClusterInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
)
)
<
4
{
goto
overflow
goto
overflow
}
}
p
.
State
=
ClusterState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
p
.
State
=
ClusterState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
...
@@ -3054,7 +2730,7 @@ func (p *X_ClusterState) NEOEncode(data []byte) {
...
@@ -3054,7 +2730,7 @@ func (p *X_ClusterState) NEOEncode(data []byte) {
}
}
func
(
p
*
X_ClusterState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
X_ClusterState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
)
)
<
4
{
goto
overflow
goto
overflow
}
}
p
.
State
=
ClusterState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
p
.
State
=
ClusterState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
...
@@ -3088,29 +2764,23 @@ func (p *ObjectUndoSerial) NEOEncode(data []byte) {
...
@@ -3088,29 +2764,23 @@ func (p *ObjectUndoSerial) NEOEncode(data []byte) {
func
(
p
*
ObjectUndoSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
ObjectUndoSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
2
8
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
LTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
LTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
if
len
(
data
)
<
24
{
goto
overflow
}
p
.
UndoneTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
p
.
UndoneTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
{
{
if
len
(
data
)
<
28
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
24
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
24
:
])
data
=
data
[
28
:
]
data
=
data
[
28
:
]
nread0
+=
28
nread0
+=
28
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
OidList
=
make
([]
Oid
,
l
)
p
.
OidList
=
make
([]
Oid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
:=
&
p
.
OidList
[
i
]
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
(
*
a
)
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -3152,13 +2822,16 @@ func (p *AnswerObjectUndoSerial) NEOEncode(data []byte) {
...
@@ -3152,13 +2822,16 @@ func (p *AnswerObjectUndoSerial) NEOEncode(data []byte) {
func
(
p
*
AnswerObjectUndoSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerObjectUndoSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
nread0
+=
4
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
ObjectTIDDict
=
make
(
map
[
Oid
]
struct
{
p
.
ObjectTIDDict
=
make
(
map
[
Oid
]
struct
{
CurrentSerial
Tid
CurrentSerial
Tid
UndoSerial
Tid
UndoSerial
Tid
...
@@ -3166,7 +2839,7 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
...
@@ -3166,7 +2839,7 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
},
l
)
},
l
)
m
:=
p
.
ObjectTIDDict
m
:=
p
.
ObjectTIDDict
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
25
{
goto
overflow
goto
overflow
}
}
key
:=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
key
:=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -3175,17 +2848,8 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
...
@@ -3175,17 +2848,8 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
UndoSerial
Tid
UndoSerial
Tid
IsCurrent
bool
IsCurrent
bool
}
}
if
len
(
data
)
<
16
{
goto
overflow
}
v
.
CurrentSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
v
.
CurrentSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
if
len
(
data
)
<
24
{
goto
overflow
}
v
.
UndoSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
v
.
UndoSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
if
len
(
data
)
<
25
{
goto
overflow
}
v
.
IsCurrent
=
byte2bool
((
data
[
24
:
])[
0
])
v
.
IsCurrent
=
byte2bool
((
data
[
24
:
])[
0
])
m
[
key
]
=
v
m
[
key
]
=
v
data
=
data
[
25
:
]
data
=
data
[
25
:
]
...
@@ -3210,13 +2874,10 @@ func (p *HasLock) NEOEncode(data []byte) {
...
@@ -3210,13 +2874,10 @@ func (p *HasLock) NEOEncode(data []byte) {
}
}
func
(
p
*
HasLock
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
HasLock
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
return
16
,
nil
return
16
,
nil
...
@@ -3236,13 +2897,10 @@ func (p *AnswerHasLock) NEOEncode(data []byte) {
...
@@ -3236,13 +2897,10 @@ func (p *AnswerHasLock) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerHasLock
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerHasLock
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
goto
overflow
}
}
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
12
{
goto
overflow
}
p
.
LockState
=
LockState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])))
p
.
LockState
=
LockState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])))
return
12
,
nil
return
12
,
nil
...
@@ -3263,17 +2921,11 @@ func (p *CheckCurrentSerial) NEOEncode(data []byte) {
...
@@ -3263,17 +2921,11 @@ func (p *CheckCurrentSerial) NEOEncode(data []byte) {
}
}
func
(
p
*
CheckCurrentSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckCurrentSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
if
len
(
data
)
<
24
{
goto
overflow
}
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
return
24
,
nil
return
24
,
nil
...
@@ -3294,17 +2946,11 @@ func (p *AnswerCheckCurrentSerial) NEOEncode(data []byte) {
...
@@ -3294,17 +2946,11 @@ func (p *AnswerCheckCurrentSerial) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerCheckCurrentSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerCheckCurrentSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
1
{
if
uint32
(
len
(
data
))
<
17
{
goto
overflow
goto
overflow
}
}
p
.
Conflicting
=
byte2bool
((
data
[
0
:
])[
0
])
p
.
Conflicting
=
byte2bool
((
data
[
0
:
])[
0
])
if
len
(
data
)
<
9
{
goto
overflow
}
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
1
:
]))
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
1
:
]))
if
len
(
data
)
<
17
{
goto
overflow
}
p
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
9
:
]))
p
.
Serial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
9
:
]))
return
17
,
nil
return
17
,
nil
...
@@ -3323,7 +2969,7 @@ func (p *Pack) NEOEncode(data []byte) {
...
@@ -3323,7 +2969,7 @@ func (p *Pack) NEOEncode(data []byte) {
}
}
func
(
p
*
Pack
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Pack
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
@@ -3344,7 +2990,7 @@ func (p *AnswerPack) NEOEncode(data []byte) {
...
@@ -3344,7 +2990,7 @@ func (p *AnswerPack) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerPack
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerPack
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
1
{
if
uint32
(
len
(
data
)
)
<
1
{
goto
overflow
goto
overflow
}
}
p
.
Status
=
byte2bool
((
data
[
0
:
])[
0
])
p
.
Status
=
byte2bool
((
data
[
0
:
])[
0
])
...
@@ -3382,35 +3028,32 @@ func (p *CheckReplicas) NEOEncode(data []byte) {
...
@@ -3382,35 +3028,32 @@ func (p *CheckReplicas) NEOEncode(data []byte) {
func
(
p
*
CheckReplicas
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckReplicas
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
nread0
+=
4
nread0
+=
4
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
PartitionDict
=
make
(
map
[
uint32
]
UUID
,
l
)
p
.
PartitionDict
=
make
(
map
[
uint32
]
UUID
,
l
)
m
:=
p
.
PartitionDict
m
:=
p
.
PartitionDict
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
key
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
key
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
if
len
(
data
)
<
8
{
goto
overflow
}
m
[
key
]
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
m
[
key
]
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
nread0
+=
8
}
}
}
if
uint32
(
len
(
data
))
<
16
{
if
len
(
data
)
<
8
{
goto
overflow
goto
overflow
}
}
}
p
.
MinTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
MinTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
return
16
+
int
(
nread0
),
nil
return
16
+
int
(
nread0
),
nil
...
@@ -3447,47 +3090,32 @@ func (p *CheckPartition) NEOEncode(data []byte) {
...
@@ -3447,47 +3090,32 @@ func (p *CheckPartition) NEOEncode(data []byte) {
func
(
p
*
CheckPartition
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckPartition
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
{
if
len
(
data
)
<
8
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
data
=
data
[
8
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
8
+
l
if
uint32
(
len
(
data
))
<
4
+
l
{
goto
overflow
goto
overflow
}
}
p
.
Source
.
UpstreamName
=
string
(
data
[
:
l
])
p
.
Source
.
UpstreamName
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
8
+
l
}
}
{
{
if
len
(
data
)
<
4
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
l
{
nread0
+=
4
+
l
if
uint32
(
len
(
data
))
<
18
+
l
{
goto
overflow
goto
overflow
}
}
p
.
Source
.
Address
.
Host
=
string
(
data
[
:
l
])
p
.
Source
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
data
=
data
[
l
:
]
nread0
+=
4
+
l
}
if
len
(
data
)
<
2
{
goto
overflow
}
}
p
.
Source
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
Source
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
if
len
(
data
)
<
10
{
goto
overflow
}
p
.
MinTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
2
:
]))
p
.
MinTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
2
:
]))
if
len
(
data
)
<
18
{
goto
overflow
}
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
10
:
]))
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
10
:
]))
return
18
+
int
(
nread0
),
nil
return
18
+
int
(
nread0
),
nil
...
@@ -3509,21 +3137,12 @@ func (p *CheckTIDRange) NEOEncode(data []byte) {
...
@@ -3509,21 +3137,12 @@ func (p *CheckTIDRange) NEOEncode(data []byte) {
}
}
func
(
p
*
CheckTIDRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckTIDRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
2
4
{
goto
overflow
goto
overflow
}
}
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
if
len
(
data
)
<
8
{
goto
overflow
}
p
.
Length
=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
p
.
Length
=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
MinTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
MinTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
if
len
(
data
)
<
24
{
goto
overflow
}
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
return
24
,
nil
return
24
,
nil
...
@@ -3563,93 +3182,30 @@ func (p *AnswerCheckTIDRange) NEOEncode(data []byte) {
...
@@ -3563,93 +3182,30 @@ func (p *AnswerCheckTIDRange) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerCheckTIDRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerCheckTIDRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
32
{
goto
overflow
goto
overflow
}
}
p
.
Count
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Count
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
if
len
(
data
)
<
5
{
goto
overflow
}
p
.
Checksum
[
0
]
=
(
data
[
4
:
])[
0
]
p
.
Checksum
[
0
]
=
(
data
[
4
:
])[
0
]
if
len
(
data
)
<
6
{
goto
overflow
}
p
.
Checksum
[
1
]
=
(
data
[
5
:
])[
0
]
p
.
Checksum
[
1
]
=
(
data
[
5
:
])[
0
]
if
len
(
data
)
<
7
{
goto
overflow
}
p
.
Checksum
[
2
]
=
(
data
[
6
:
])[
0
]
p
.
Checksum
[
2
]
=
(
data
[
6
:
])[
0
]
if
len
(
data
)
<
8
{
goto
overflow
}
p
.
Checksum
[
3
]
=
(
data
[
7
:
])[
0
]
p
.
Checksum
[
3
]
=
(
data
[
7
:
])[
0
]
if
len
(
data
)
<
9
{
goto
overflow
}
p
.
Checksum
[
4
]
=
(
data
[
8
:
])[
0
]
p
.
Checksum
[
4
]
=
(
data
[
8
:
])[
0
]
if
len
(
data
)
<
10
{
goto
overflow
}
p
.
Checksum
[
5
]
=
(
data
[
9
:
])[
0
]
p
.
Checksum
[
5
]
=
(
data
[
9
:
])[
0
]
if
len
(
data
)
<
11
{
goto
overflow
}
p
.
Checksum
[
6
]
=
(
data
[
10
:
])[
0
]
p
.
Checksum
[
6
]
=
(
data
[
10
:
])[
0
]
if
len
(
data
)
<
12
{
goto
overflow
}
p
.
Checksum
[
7
]
=
(
data
[
11
:
])[
0
]
p
.
Checksum
[
7
]
=
(
data
[
11
:
])[
0
]
if
len
(
data
)
<
13
{
goto
overflow
}
p
.
Checksum
[
8
]
=
(
data
[
12
:
])[
0
]
p
.
Checksum
[
8
]
=
(
data
[
12
:
])[
0
]
if
len
(
data
)
<
14
{
goto
overflow
}
p
.
Checksum
[
9
]
=
(
data
[
13
:
])[
0
]
p
.
Checksum
[
9
]
=
(
data
[
13
:
])[
0
]
if
len
(
data
)
<
15
{
goto
overflow
}
p
.
Checksum
[
10
]
=
(
data
[
14
:
])[
0
]
p
.
Checksum
[
10
]
=
(
data
[
14
:
])[
0
]
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
Checksum
[
11
]
=
(
data
[
15
:
])[
0
]
p
.
Checksum
[
11
]
=
(
data
[
15
:
])[
0
]
if
len
(
data
)
<
17
{
goto
overflow
}
p
.
Checksum
[
12
]
=
(
data
[
16
:
])[
0
]
p
.
Checksum
[
12
]
=
(
data
[
16
:
])[
0
]
if
len
(
data
)
<
18
{
goto
overflow
}
p
.
Checksum
[
13
]
=
(
data
[
17
:
])[
0
]
p
.
Checksum
[
13
]
=
(
data
[
17
:
])[
0
]
if
len
(
data
)
<
19
{
goto
overflow
}
p
.
Checksum
[
14
]
=
(
data
[
18
:
])[
0
]
p
.
Checksum
[
14
]
=
(
data
[
18
:
])[
0
]
if
len
(
data
)
<
20
{
goto
overflow
}
p
.
Checksum
[
15
]
=
(
data
[
19
:
])[
0
]
p
.
Checksum
[
15
]
=
(
data
[
19
:
])[
0
]
if
len
(
data
)
<
21
{
goto
overflow
}
p
.
Checksum
[
16
]
=
(
data
[
20
:
])[
0
]
p
.
Checksum
[
16
]
=
(
data
[
20
:
])[
0
]
if
len
(
data
)
<
22
{
goto
overflow
}
p
.
Checksum
[
17
]
=
(
data
[
21
:
])[
0
]
p
.
Checksum
[
17
]
=
(
data
[
21
:
])[
0
]
if
len
(
data
)
<
23
{
goto
overflow
}
p
.
Checksum
[
18
]
=
(
data
[
22
:
])[
0
]
p
.
Checksum
[
18
]
=
(
data
[
22
:
])[
0
]
if
len
(
data
)
<
24
{
goto
overflow
}
p
.
Checksum
[
19
]
=
(
data
[
23
:
])[
0
]
p
.
Checksum
[
19
]
=
(
data
[
23
:
])[
0
]
if
len
(
data
)
<
32
{
goto
overflow
}
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
24
:
]))
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
24
:
]))
return
32
,
nil
return
32
,
nil
...
@@ -3672,25 +3228,13 @@ func (p *CheckSerialRange) NEOEncode(data []byte) {
...
@@ -3672,25 +3228,13 @@ func (p *CheckSerialRange) NEOEncode(data []byte) {
}
}
func
(
p
*
CheckSerialRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckSerialRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
32
{
goto
overflow
goto
overflow
}
}
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
if
len
(
data
)
<
8
{
goto
overflow
}
p
.
Length
=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
p
.
Length
=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
MinTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
MinTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
if
len
(
data
)
<
24
{
goto
overflow
}
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
if
len
(
data
)
<
32
{
goto
overflow
}
p
.
MinOID
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
24
:
]))
p
.
MinOID
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
24
:
]))
return
32
,
nil
return
32
,
nil
...
@@ -3751,177 +3295,51 @@ func (p *AnswerCheckSerialRange) NEOEncode(data []byte) {
...
@@ -3751,177 +3295,51 @@ func (p *AnswerCheckSerialRange) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerCheckSerialRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerCheckSerialRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
60
{
goto
overflow
goto
overflow
}
}
p
.
Count
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Count
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
if
len
(
data
)
<
5
{
goto
overflow
}
p
.
TidChecksum
[
0
]
=
(
data
[
4
:
])[
0
]
p
.
TidChecksum
[
0
]
=
(
data
[
4
:
])[
0
]
if
len
(
data
)
<
6
{
goto
overflow
}
p
.
TidChecksum
[
1
]
=
(
data
[
5
:
])[
0
]
p
.
TidChecksum
[
1
]
=
(
data
[
5
:
])[
0
]
if
len
(
data
)
<
7
{
goto
overflow
}
p
.
TidChecksum
[
2
]
=
(
data
[
6
:
])[
0
]
p
.
TidChecksum
[
2
]
=
(
data
[
6
:
])[
0
]
if
len
(
data
)
<
8
{
goto
overflow
}
p
.
TidChecksum
[
3
]
=
(
data
[
7
:
])[
0
]
p
.
TidChecksum
[
3
]
=
(
data
[
7
:
])[
0
]
if
len
(
data
)
<
9
{
goto
overflow
}
p
.
TidChecksum
[
4
]
=
(
data
[
8
:
])[
0
]
p
.
TidChecksum
[
4
]
=
(
data
[
8
:
])[
0
]
if
len
(
data
)
<
10
{
goto
overflow
}
p
.
TidChecksum
[
5
]
=
(
data
[
9
:
])[
0
]
p
.
TidChecksum
[
5
]
=
(
data
[
9
:
])[
0
]
if
len
(
data
)
<
11
{
goto
overflow
}
p
.
TidChecksum
[
6
]
=
(
data
[
10
:
])[
0
]
p
.
TidChecksum
[
6
]
=
(
data
[
10
:
])[
0
]
if
len
(
data
)
<
12
{
goto
overflow
}
p
.
TidChecksum
[
7
]
=
(
data
[
11
:
])[
0
]
p
.
TidChecksum
[
7
]
=
(
data
[
11
:
])[
0
]
if
len
(
data
)
<
13
{
goto
overflow
}
p
.
TidChecksum
[
8
]
=
(
data
[
12
:
])[
0
]
p
.
TidChecksum
[
8
]
=
(
data
[
12
:
])[
0
]
if
len
(
data
)
<
14
{
goto
overflow
}
p
.
TidChecksum
[
9
]
=
(
data
[
13
:
])[
0
]
p
.
TidChecksum
[
9
]
=
(
data
[
13
:
])[
0
]
if
len
(
data
)
<
15
{
goto
overflow
}
p
.
TidChecksum
[
10
]
=
(
data
[
14
:
])[
0
]
p
.
TidChecksum
[
10
]
=
(
data
[
14
:
])[
0
]
if
len
(
data
)
<
16
{
goto
overflow
}
p
.
TidChecksum
[
11
]
=
(
data
[
15
:
])[
0
]
p
.
TidChecksum
[
11
]
=
(
data
[
15
:
])[
0
]
if
len
(
data
)
<
17
{
goto
overflow
}
p
.
TidChecksum
[
12
]
=
(
data
[
16
:
])[
0
]
p
.
TidChecksum
[
12
]
=
(
data
[
16
:
])[
0
]
if
len
(
data
)
<
18
{
goto
overflow
}
p
.
TidChecksum
[
13
]
=
(
data
[
17
:
])[
0
]
p
.
TidChecksum
[
13
]
=
(
data
[
17
:
])[
0
]
if
len
(
data
)
<
19
{
goto
overflow
}
p
.
TidChecksum
[
14
]
=
(
data
[
18
:
])[
0
]
p
.
TidChecksum
[
14
]
=
(
data
[
18
:
])[
0
]
if
len
(
data
)
<
20
{
goto
overflow
}
p
.
TidChecksum
[
15
]
=
(
data
[
19
:
])[
0
]
p
.
TidChecksum
[
15
]
=
(
data
[
19
:
])[
0
]
if
len
(
data
)
<
21
{
goto
overflow
}
p
.
TidChecksum
[
16
]
=
(
data
[
20
:
])[
0
]
p
.
TidChecksum
[
16
]
=
(
data
[
20
:
])[
0
]
if
len
(
data
)
<
22
{
goto
overflow
}
p
.
TidChecksum
[
17
]
=
(
data
[
21
:
])[
0
]
p
.
TidChecksum
[
17
]
=
(
data
[
21
:
])[
0
]
if
len
(
data
)
<
23
{
goto
overflow
}
p
.
TidChecksum
[
18
]
=
(
data
[
22
:
])[
0
]
p
.
TidChecksum
[
18
]
=
(
data
[
22
:
])[
0
]
if
len
(
data
)
<
24
{
goto
overflow
}
p
.
TidChecksum
[
19
]
=
(
data
[
23
:
])[
0
]
p
.
TidChecksum
[
19
]
=
(
data
[
23
:
])[
0
]
if
len
(
data
)
<
32
{
goto
overflow
}
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
24
:
]))
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
24
:
]))
if
len
(
data
)
<
33
{
goto
overflow
}
p
.
OidChecksum
[
0
]
=
(
data
[
32
:
])[
0
]
p
.
OidChecksum
[
0
]
=
(
data
[
32
:
])[
0
]
if
len
(
data
)
<
34
{
goto
overflow
}
p
.
OidChecksum
[
1
]
=
(
data
[
33
:
])[
0
]
p
.
OidChecksum
[
1
]
=
(
data
[
33
:
])[
0
]
if
len
(
data
)
<
35
{
goto
overflow
}
p
.
OidChecksum
[
2
]
=
(
data
[
34
:
])[
0
]
p
.
OidChecksum
[
2
]
=
(
data
[
34
:
])[
0
]
if
len
(
data
)
<
36
{
goto
overflow
}
p
.
OidChecksum
[
3
]
=
(
data
[
35
:
])[
0
]
p
.
OidChecksum
[
3
]
=
(
data
[
35
:
])[
0
]
if
len
(
data
)
<
37
{
goto
overflow
}
p
.
OidChecksum
[
4
]
=
(
data
[
36
:
])[
0
]
p
.
OidChecksum
[
4
]
=
(
data
[
36
:
])[
0
]
if
len
(
data
)
<
38
{
goto
overflow
}
p
.
OidChecksum
[
5
]
=
(
data
[
37
:
])[
0
]
p
.
OidChecksum
[
5
]
=
(
data
[
37
:
])[
0
]
if
len
(
data
)
<
39
{
goto
overflow
}
p
.
OidChecksum
[
6
]
=
(
data
[
38
:
])[
0
]
p
.
OidChecksum
[
6
]
=
(
data
[
38
:
])[
0
]
if
len
(
data
)
<
40
{
goto
overflow
}
p
.
OidChecksum
[
7
]
=
(
data
[
39
:
])[
0
]
p
.
OidChecksum
[
7
]
=
(
data
[
39
:
])[
0
]
if
len
(
data
)
<
41
{
goto
overflow
}
p
.
OidChecksum
[
8
]
=
(
data
[
40
:
])[
0
]
p
.
OidChecksum
[
8
]
=
(
data
[
40
:
])[
0
]
if
len
(
data
)
<
42
{
goto
overflow
}
p
.
OidChecksum
[
9
]
=
(
data
[
41
:
])[
0
]
p
.
OidChecksum
[
9
]
=
(
data
[
41
:
])[
0
]
if
len
(
data
)
<
43
{
goto
overflow
}
p
.
OidChecksum
[
10
]
=
(
data
[
42
:
])[
0
]
p
.
OidChecksum
[
10
]
=
(
data
[
42
:
])[
0
]
if
len
(
data
)
<
44
{
goto
overflow
}
p
.
OidChecksum
[
11
]
=
(
data
[
43
:
])[
0
]
p
.
OidChecksum
[
11
]
=
(
data
[
43
:
])[
0
]
if
len
(
data
)
<
45
{
goto
overflow
}
p
.
OidChecksum
[
12
]
=
(
data
[
44
:
])[
0
]
p
.
OidChecksum
[
12
]
=
(
data
[
44
:
])[
0
]
if
len
(
data
)
<
46
{
goto
overflow
}
p
.
OidChecksum
[
13
]
=
(
data
[
45
:
])[
0
]
p
.
OidChecksum
[
13
]
=
(
data
[
45
:
])[
0
]
if
len
(
data
)
<
47
{
goto
overflow
}
p
.
OidChecksum
[
14
]
=
(
data
[
46
:
])[
0
]
p
.
OidChecksum
[
14
]
=
(
data
[
46
:
])[
0
]
if
len
(
data
)
<
48
{
goto
overflow
}
p
.
OidChecksum
[
15
]
=
(
data
[
47
:
])[
0
]
p
.
OidChecksum
[
15
]
=
(
data
[
47
:
])[
0
]
if
len
(
data
)
<
49
{
goto
overflow
}
p
.
OidChecksum
[
16
]
=
(
data
[
48
:
])[
0
]
p
.
OidChecksum
[
16
]
=
(
data
[
48
:
])[
0
]
if
len
(
data
)
<
50
{
goto
overflow
}
p
.
OidChecksum
[
17
]
=
(
data
[
49
:
])[
0
]
p
.
OidChecksum
[
17
]
=
(
data
[
49
:
])[
0
]
if
len
(
data
)
<
51
{
goto
overflow
}
p
.
OidChecksum
[
18
]
=
(
data
[
50
:
])[
0
]
p
.
OidChecksum
[
18
]
=
(
data
[
50
:
])[
0
]
if
len
(
data
)
<
52
{
goto
overflow
}
p
.
OidChecksum
[
19
]
=
(
data
[
51
:
])[
0
]
p
.
OidChecksum
[
19
]
=
(
data
[
51
:
])[
0
]
if
len
(
data
)
<
60
{
goto
overflow
}
p
.
MaxOID
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
52
:
]))
p
.
MaxOID
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
52
:
]))
return
60
,
nil
return
60
,
nil
...
@@ -3951,21 +3369,21 @@ func (p *PartitionCorrupted) NEOEncode(data []byte) {
...
@@ -3951,21 +3369,21 @@ func (p *PartitionCorrupted) NEOEncode(data []byte) {
func
(
p
*
PartitionCorrupted
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
PartitionCorrupted
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread0
uint32
var
nread0
uint32
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
{
if
len
(
data
)
<
8
{
goto
overflow
}
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
data
=
data
[
8
:
]
nread0
+=
8
nread0
+=
8
if
uint32
(
len
(
data
))
<
l
{
goto
overflow
}
p
.
CellList
=
make
([]
UUID
,
l
)
p
.
CellList
=
make
([]
UUID
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
a
:=
&
p
.
CellList
[
i
]
if
len
(
data
)
<
4
{
if
uint32
(
len
(
data
)
)
<
4
{
goto
overflow
goto
overflow
}
}
(
*
a
)
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
(
*
a
)
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
...
@@ -4003,7 +3421,7 @@ func (p *AnswerLastTransaction) NEOEncode(data []byte) {
...
@@ -4003,7 +3421,7 @@ func (p *AnswerLastTransaction) NEOEncode(data []byte) {
}
}
func
(
p
*
AnswerLastTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerLastTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
len
(
data
)
<
8
{
if
uint32
(
len
(
data
)
)
<
8
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
t/neo/protogen.go
View file @
1f1bf04d
...
@@ -230,9 +230,11 @@ type CodecCodeGen interface {
...
@@ -230,9 +230,11 @@ type CodecCodeGen interface {
// for not function this is generated code needed for resultExpr()
// for not function this is generated code needed for resultExpr()
generatedCode
()
string
generatedCode
()
string
/*
// get result expression
// get result expression
// this is result of computations for not top-level code XXX
// this is result of computations for not top-level code XXX
resultExpr() string
resultExpr() string
*/
}
}
// common part of codegenerators
// common part of codegenerators
...
@@ -283,10 +285,18 @@ func (s *size) AddExpr(format string, a ...interface{}) {
...
@@ -283,10 +285,18 @@ func (s *size) AddExpr(format string, a ...interface{}) {
}
}
func
(
s
*
size
)
String
()
string
{
func
(
s
*
size
)
String
()
string
{
sizeStr
:=
fmt
.
Sprintf
(
"%v"
,
s
.
num
)
// num + expr1 + expr2 + ... (ommiting what is possible)
sizev
:=
[]
string
{}
if
s
.
num
!=
0
{
sizev
=
append
(
sizev
,
fmt
.
Sprintf
(
"%v"
,
s
.
num
))
}
exprStr
:=
s
.
ExprString
()
exprStr
:=
s
.
ExprString
()
if
exprStr
!=
""
{
if
exprStr
!=
""
{
sizeStr
+=
" + "
+
exprStr
sizev
=
append
(
sizev
,
exprStr
)
}
sizeStr
:=
strings
.
Join
(
sizev
,
" + "
)
if
sizeStr
==
""
{
sizeStr
=
"0"
}
}
return
sizeStr
return
sizeStr
}
}
...
@@ -295,6 +305,10 @@ func (s *size) ExprString() string {
...
@@ -295,6 +305,10 @@ func (s *size) ExprString() string {
return
strings
.
Join
(
s
.
exprv
,
" + "
)
return
strings
.
Join
(
s
.
exprv
,
" + "
)
}
}
func
(
s
*
size
)
IsZero
()
bool
{
return
s
.
num
==
0
&&
len
(
s
.
exprv
)
==
0
}
// sizer generates code to compute endoded size of a packet
// sizer generates code to compute endoded size of a packet
type
sizer
struct
{
type
sizer
struct
{
...
@@ -314,8 +328,16 @@ type encoder struct {
...
@@ -314,8 +328,16 @@ type encoder struct {
// decoder generates code to decode a packet
// decoder generates code to decode a packet
type
decoder
struct
{
type
decoder
struct
{
Buffer
// buffer for generated code
// buffers for generated code
n
int
// current decode position in data
// current delayed overflow check will be inserted in between buf & bufCur
buf
Buffer
bufCur
Buffer
// current decode position in data.
// also = currently collected info for delayed emit of overflow check
// .num - position
// .exprv - XXX TODO
pos
size
commonCoder
commonCoder
}
}
...
@@ -361,10 +383,6 @@ func (s *sizer) generatedCode() string {
...
@@ -361,10 +383,6 @@ func (s *sizer) generatedCode() string {
return
code
.
String
()
return
code
.
String
()
}
}
func
(
e
*
encoder
)
resultExpr
()
string
{
panic
(
"should not be called (?)"
)
// XXX
}
func
(
e
*
encoder
)
generatedCode
()
string
{
func
(
e
*
encoder
)
generatedCode
()
string
{
code
:=
Buffer
{}
code
:=
Buffer
{}
// prologue
// prologue
...
@@ -380,11 +398,24 @@ func (e *encoder) generatedCode() string {
...
@@ -380,11 +398,24 @@ func (e *encoder) generatedCode() string {
return
code
.
String
()
return
code
.
String
()
}
}
func
(
d
*
decoder
)
resultExpr
()
string
{
// XXX place?
panic
(
"should not be called (?)"
)
// XXX
func
(
d
*
decoder
)
emit
(
format
string
,
a
...
interface
{})
{
d
.
bufCur
.
emit
(
format
,
a
...
)
}
// XXX place?
func
(
d
*
decoder
)
flushOverflow
()
{
if
!
d
.
pos
.
IsZero
()
{
d
.
buf
.
emit
(
"if uint32(len(data)) < %v { goto overflow }"
,
&
d
.
pos
)
}
d
.
buf
.
Write
(
d
.
bufCur
.
Bytes
())
d
.
bufCur
.
Reset
()
// TODO
}
}
func
(
d
*
decoder
)
generatedCode
()
string
{
func
(
d
*
decoder
)
generatedCode
()
string
{
d
.
flushOverflow
()
code
:=
Buffer
{}
code
:=
Buffer
{}
// prologue
// prologue
if
d
.
recvName
!=
""
{
if
d
.
recvName
!=
""
{
...
@@ -394,10 +425,10 @@ func (d *decoder) generatedCode() string {
...
@@ -394,10 +425,10 @@ func (d *decoder) generatedCode() string {
code
.
emit
(
"var %v uint32"
,
d
.
var__
(
"nread"
))
code
.
emit
(
"var %v uint32"
,
d
.
var__
(
"nread"
))
}
}
code
.
Write
(
d
.
Bytes
())
// XXX -> d.buf.Bytes() ?
code
.
Write
(
d
.
buf
.
Bytes
())
// epilogue
// epilogue
retexpr
:=
fmt
.
Sprintf
(
"%v"
,
d
.
n
)
retexpr
:=
fmt
.
Sprintf
(
"%v"
,
d
.
pos
.
num
)
if
d
.
varUsed
[
"nread"
]
{
if
d
.
varUsed
[
"nread"
]
{
retexpr
+=
fmt
.
Sprintf
(
" + int(%v)"
,
d
.
var__
(
"nread"
))
retexpr
+=
fmt
.
Sprintf
(
" + int(%v)"
,
d
.
var__
(
"nread"
))
}
}
...
@@ -434,10 +465,10 @@ func (e *encoder) genBasic(path string, typ *types.Basic, userType types.Type) {
...
@@ -434,10 +465,10 @@ func (e *encoder) genBasic(path string, typ *types.Basic, userType types.Type) {
func
(
d
*
decoder
)
genBasic
(
assignto
string
,
typ
*
types
.
Basic
,
userType
types
.
Type
)
{
func
(
d
*
decoder
)
genBasic
(
assignto
string
,
typ
*
types
.
Basic
,
userType
types
.
Type
)
{
basic
:=
basicTypes
[
typ
.
Kind
()]
basic
:=
basicTypes
[
typ
.
Kind
()]
d
.
emit
(
"if len(data) < %v { goto overflow }"
,
d
.
n
+
basic
.
wireSize
)
//
d.emit("if len(data) < %v { goto overflow }", d.n + basic.wireSize)
dataptr
:=
fmt
.
Sprintf
(
"data[%v:]"
,
d
.
n
)
dataptr
:=
fmt
.
Sprintf
(
"data[%v:]"
,
d
.
pos
.
num
)
decoded
:=
fmt
.
Sprintf
(
basic
.
decode
,
dataptr
)
decoded
:=
fmt
.
Sprintf
(
basic
.
decode
,
dataptr
)
d
.
n
+=
basic
.
wireSize
d
.
pos
.
Add
(
basic
.
wireSize
)
if
userType
!=
nil
&&
userType
!=
typ
{
if
userType
!=
nil
&&
userType
!=
typ
{
// userType is a named type over some basic, like
// userType is a named type over some basic, like
// type ClusterState int32
// type ClusterState int32
...
@@ -472,13 +503,17 @@ func (e *encoder) genStrBytes(path string) {
...
@@ -472,13 +503,17 @@ func (e *encoder) genStrBytes(path string) {
func
(
d
*
decoder
)
genStrBytes
(
assignto
string
)
{
func
(
d
*
decoder
)
genStrBytes
(
assignto
string
)
{
d
.
emit
(
"{"
)
d
.
emit
(
"{"
)
d
.
genBasic
(
"l:"
,
types
.
Typ
[
types
.
Uint32
],
nil
)
d
.
genBasic
(
"l:"
,
types
.
Typ
[
types
.
Uint32
],
nil
)
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
d
.
emit
(
"data = data[%v:]"
,
d
.
pos
.
num
)
d
.
emit
(
"if uint32(len(data)) < l { goto overflow }"
)
d
.
emit
(
"%v += %v + l"
,
d
.
var_
(
"nread"
),
d
.
pos
.
num
)
//d.emit("if uint32(len(data)) < l { goto overflow }")
d
.
flushOverflow
()
d
.
pos
=
size
{}
// zero
d
.
pos
.
AddExpr
(
"l"
)
d
.
emit
(
"%v= string(data[:l])"
,
assignto
)
d
.
emit
(
"%v= string(data[:l])"
,
assignto
)
d
.
emit
(
"data = data[l:]"
)
d
.
emit
(
"data = data[l:]"
)
d
.
emit
(
"%v += %v + l"
,
d
.
var_
(
"nread"
),
d
.
n
)
d
.
emit
(
"}"
)
d
.
emit
(
"}"
)
d
.
n
=
0
}
}
// emit code to encode/decode slice
// emit code to encode/decode slice
...
@@ -540,9 +575,12 @@ func (e *encoder) genSlice(path string, typ *types.Slice, obj types.Object) {
...
@@ -540,9 +575,12 @@ func (e *encoder) genSlice(path string, typ *types.Slice, obj types.Object) {
func
(
d
*
decoder
)
genSlice
(
assignto
string
,
typ
*
types
.
Slice
,
obj
types
.
Object
)
{
func
(
d
*
decoder
)
genSlice
(
assignto
string
,
typ
*
types
.
Slice
,
obj
types
.
Object
)
{
d
.
emit
(
"{"
)
d
.
emit
(
"{"
)
d
.
genBasic
(
"l:"
,
types
.
Typ
[
types
.
Uint32
],
nil
)
d
.
genBasic
(
"l:"
,
types
.
Typ
[
types
.
Uint32
],
nil
)
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
d
.
emit
(
"data = data[%v:]"
,
d
.
pos
.
num
)
d
.
emit
(
"%v += %v"
,
d
.
var_
(
"nread"
),
d
.
n
)
d
.
emit
(
"%v += %v"
,
d
.
var_
(
"nread"
),
d
.
pos
.
num
)
d
.
n
=
0
d
.
flushOverflow
()
d
.
pos
=
size
{}
// zero
d
.
pos
.
AddExpr
(
"l"
)
/*
/*
elemSize, elemFixed := typeSizeFixed(typ.Elem())
elemSize, elemFixed := typeSizeFixed(typ.Elem())
...
@@ -557,13 +595,22 @@ func (d *decoder) genSlice(assignto string, typ *types.Slice, obj types.Object)
...
@@ -557,13 +595,22 @@ func (d *decoder) genSlice(assignto string, typ *types.Slice, obj types.Object)
d
.
emit
(
"%v= make(%v, l)"
,
assignto
,
typeName
(
typ
))
d
.
emit
(
"%v= make(%v, l)"
,
assignto
,
typeName
(
typ
))
d
.
emit
(
"for i := 0; uint32(i) < l; i++ {"
)
d
.
emit
(
"for i := 0; uint32(i) < l; i++ {"
)
d
.
emit
(
"a := &%s[i]"
,
assignto
)
d
.
emit
(
"a := &%s[i]"
,
assignto
)
d
.
flushOverflow
()
d
.
pos
=
size
{}
// zero
codegenType
(
"(*a)"
,
typ
.
Elem
(),
obj
,
d
)
codegenType
(
"(*a)"
,
typ
.
Elem
(),
obj
,
d
)
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
// FIXME wrt slice of slice ?
d
.
emit
(
"%v += %v"
,
d
.
var_
(
"nread"
),
d
.
n
)
d
.
emit
(
"data = data[%v:]"
,
d
.
pos
.
num
)
// FIXME wrt slice of slice ?
d
.
emit
(
"%v += %v"
,
d
.
var_
(
"nread"
),
d
.
pos
.
num
)
d
.
emit
(
"}"
)
d
.
emit
(
"}"
)
d
.
flushOverflow
()
d
.
pos
=
size
{}
// zero
//d.emit("%v= string(data[:l])", assignto)
//d.emit("%v= string(data[:l])", assignto)
d
.
emit
(
"}"
)
d
.
emit
(
"}"
)
d
.
n
=
0
//
d.n = 0
}
}
// generate code to encode/decode map
// generate code to encode/decode map
...
@@ -628,15 +675,22 @@ func (e *encoder) genMap(path string, typ *types.Map, obj types.Object) {
...
@@ -628,15 +675,22 @@ func (e *encoder) genMap(path string, typ *types.Map, obj types.Object) {
func
(
d
*
decoder
)
genMap
(
assignto
string
,
typ
*
types
.
Map
,
obj
types
.
Object
)
{
func
(
d
*
decoder
)
genMap
(
assignto
string
,
typ
*
types
.
Map
,
obj
types
.
Object
)
{
d
.
emit
(
"{"
)
d
.
emit
(
"{"
)
d
.
genBasic
(
"l:"
,
types
.
Typ
[
types
.
Uint32
],
nil
)
d
.
genBasic
(
"l:"
,
types
.
Typ
[
types
.
Uint32
],
nil
)
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
d
.
emit
(
"data = data[%v:]"
,
d
.
pos
.
num
)
d
.
emit
(
"%v += %v"
,
d
.
var_
(
"nread"
),
d
.
n
)
d
.
emit
(
"%v += %v"
,
d
.
var_
(
"nread"
),
d
.
pos
.
num
)
d
.
n
=
0
d
.
flushOverflow
()
d
.
pos
=
size
{}
// zero
d
.
pos
.
AddExpr
(
"l"
)
d
.
emit
(
"%v= make(%v, l)"
,
assignto
,
typeName
(
typ
))
d
.
emit
(
"%v= make(%v, l)"
,
assignto
,
typeName
(
typ
))
// TODO size check
// TODO size check
// TODO if size(item)==const - check l in one go
// TODO if size(item)==const - check l in one go
//d.emit("if len(data) < l { goto overflow }")
//d.emit("if len(data) < l { goto overflow }")
d
.
emit
(
"m := %v"
,
assignto
)
d
.
emit
(
"m := %v"
,
assignto
)
d
.
emit
(
"for i := 0; uint32(i) < l; i++ {"
)
d
.
emit
(
"for i := 0; uint32(i) < l; i++ {"
)
d
.
flushOverflow
()
d
.
pos
=
size
{}
// zero
codegenType
(
"key:"
,
typ
.
Key
(),
obj
,
d
)
codegenType
(
"key:"
,
typ
.
Key
(),
obj
,
d
)
switch
typ
.
Elem
()
.
Underlying
()
.
(
type
)
{
switch
typ
.
Elem
()
.
Underlying
()
.
(
type
)
{
...
@@ -652,12 +706,15 @@ func (d *decoder) genMap(assignto string, typ *types.Map, obj types.Object) {
...
@@ -652,12 +706,15 @@ func (d *decoder) genMap(assignto string, typ *types.Map, obj types.Object) {
d
.
emit
(
"m[key] = v"
)
d
.
emit
(
"m[key] = v"
)
}
}
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
// FIXME wrt map of map ?
d
.
emit
(
"data = data[%v:]"
,
d
.
pos
.
num
)
// FIXME wrt map of map ?
d
.
emit
(
"%v += %v"
,
d
.
var_
(
"nread"
),
d
.
n
)
d
.
emit
(
"%v += %v"
,
d
.
var_
(
"nread"
),
d
.
pos
.
num
)
d
.
emit
(
"}"
)
d
.
emit
(
"}"
)
d
.
flushOverflow
()
d
.
pos
=
size
{}
// zero
//d.emit("%v= string(data[:l])", assignto)
//d.emit("%v= string(data[:l])", assignto)
d
.
emit
(
"}"
)
d
.
emit
(
"}"
)
d
.
n
=
0
}
}
// top-level driver for emitting encode/decode code for a type
// top-level driver for emitting encode/decode code for a type
...
...
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