Commit ce26522f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 23d09bcd
...@@ -147,12 +147,12 @@ func (p *RowInfo) NEODecode(data []byte) (int, error) { ...@@ -147,12 +147,12 @@ func (p *RowInfo) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[4:]) l := binary.BigEndian.Uint32(data[4:])
data = data[8:] data = data[8:]
nread += 8 nread += 8
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[0:]))) (*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
(*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[4:]))) (*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[4:])))
data = data[8:] data = data[8:]
...@@ -740,12 +740,12 @@ func (p *AnswerPartitionTable) NEODecode(data []byte) (int, error) { ...@@ -740,12 +740,12 @@ func (p *AnswerPartitionTable) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[4:]) l := binary.BigEndian.Uint32(data[4:])
data = data[8:] data = data[8:]
nread += 8 nread += 8
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[0:]))) (*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
(*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[4:]))) (*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[4:])))
data = data[8:] data = data[8:]
...@@ -817,12 +817,12 @@ func (p *NotifyPartitionTable) NEODecode(data []byte) (int, error) { ...@@ -817,12 +817,12 @@ func (p *NotifyPartitionTable) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[4:]) l := binary.BigEndian.Uint32(data[4:])
data = data[8:] data = data[8:]
nread += 8 nread += 8
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[0:]))) (*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
(*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[4:]))) (*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[4:])))
data = data[8:] data = data[8:]
...@@ -869,6 +869,9 @@ func (p *PartitionChanges) NEODecode(data []byte) (int, error) { ...@@ -869,6 +869,9 @@ func (p *PartitionChanges) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[8:]) l := binary.BigEndian.Uint32(data[8:])
data = data[12:] data = data[12:]
nread += 12 nread += 12
if uint32(len(data)) < l*12 {
goto overflow
}
p.CellList = make([]struct { p.CellList = make([]struct {
Offset uint32 Offset uint32
UUID UUID UUID UUID
...@@ -876,9 +879,6 @@ func (p *PartitionChanges) NEODecode(data []byte) (int, error) { ...@@ -876,9 +879,6 @@ 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 uint32(len(data)) < 12 {
goto overflow
}
(*a).Offset = binary.BigEndian.Uint32(data[0:]) (*a).Offset = binary.BigEndian.Uint32(data[0:])
(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[4:]))) (*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[4:])))
(*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[8:]))) (*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[8:])))
...@@ -969,12 +969,12 @@ func (p *AnswerUnfinishedTransactions) NEODecode(data []byte) (int, error) { ...@@ -969,12 +969,12 @@ func (p *AnswerUnfinishedTransactions) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[8:]) l := binary.BigEndian.Uint32(data[8:])
data = data[12:] data = data[12:]
nread += 12 nread += 12
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a).UnfinishedTID = Tid(binary.BigEndian.Uint64(data[0:])) (*a).UnfinishedTID = Tid(binary.BigEndian.Uint64(data[0:]))
data = data[8:] data = data[8:]
nread += 8 nread += 8
...@@ -1197,12 +1197,12 @@ func (p *FinishTransaction) NEODecode(data []byte) (int, error) { ...@@ -1197,12 +1197,12 @@ func (p *FinishTransaction) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[8:]) l := binary.BigEndian.Uint32(data[8:])
data = data[12:] data = data[12:]
nread += 12 nread += 12
if uint32(len(data)) < 4+l*8 {
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 uint32(len(data)) < 12 {
goto overflow
}
(*a) = Oid(binary.BigEndian.Uint64(data[0:])) (*a) = Oid(binary.BigEndian.Uint64(data[0:]))
data = data[8:] data = data[8:]
nread += 8 nread += 8
...@@ -1212,12 +1212,12 @@ func (p *FinishTransaction) NEODecode(data []byte) (int, error) { ...@@ -1212,12 +1212,12 @@ func (p *FinishTransaction) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[0:]) l := binary.BigEndian.Uint32(data[0:])
data = data[4:] data = data[4:]
nread += 4 nread += 4
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a) = Oid(binary.BigEndian.Uint64(data[0:])) (*a) = Oid(binary.BigEndian.Uint64(data[0:]))
data = data[8:] data = data[8:]
nread += 8 nread += 8
...@@ -1349,12 +1349,12 @@ func (p *InvalidateObjects) NEODecode(data []byte) (int, error) { ...@@ -1349,12 +1349,12 @@ func (p *InvalidateObjects) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[8:]) l := binary.BigEndian.Uint32(data[8:])
data = data[12:] data = data[12:]
nread += 12 nread += 12
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a) = Oid(binary.BigEndian.Uint64(data[0:])) (*a) = Oid(binary.BigEndian.Uint64(data[0:]))
data = data[8:] data = data[8:]
nread += 8 nread += 8
...@@ -1436,12 +1436,12 @@ func (p *AnswerGenerateOIDs) NEODecode(data []byte) (int, error) { ...@@ -1436,12 +1436,12 @@ func (p *AnswerGenerateOIDs) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[0:]) l := binary.BigEndian.Uint32(data[0:])
data = data[4:] data = data[4:]
nread += 4 nread += 4
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a) = Oid(binary.BigEndian.Uint64(data[0:])) (*a) = Oid(binary.BigEndian.Uint64(data[0:]))
data = data[8:] data = data[8:]
nread += 8 nread += 8
...@@ -1530,12 +1530,12 @@ func (p *StoreObject) NEODecode(data []byte) (int, error) { ...@@ -1530,12 +1530,12 @@ func (p *StoreObject) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[37:]) l := binary.BigEndian.Uint32(data[37:])
data = data[41:] data = data[41:]
nread += 41 nread += 41
if uint32(len(data)) < 17+l*1 {
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 uint32(len(data)) < 18 {
goto overflow
}
(*a) = (data[0:])[0] (*a) = (data[0:])[0]
data = data[1:] data = data[1:]
nread += 1 nread += 1
...@@ -1677,12 +1677,12 @@ func (p *StoreTransaction) NEODecode(data []byte) (int, error) { ...@@ -1677,12 +1677,12 @@ func (p *StoreTransaction) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[0:]) l := binary.BigEndian.Uint32(data[0:])
data = data[4:] data = data[4:]
nread += 4 nread += 4
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a) = Oid(binary.BigEndian.Uint64(data[0:])) (*a) = Oid(binary.BigEndian.Uint64(data[0:]))
data = data[8:] data = data[8:]
nread += 8 nread += 8
...@@ -1817,12 +1817,12 @@ func (p *AnswerGetObject) NEODecode(data []byte) (int, error) { ...@@ -1817,12 +1817,12 @@ func (p *AnswerGetObject) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[45:]) l := binary.BigEndian.Uint32(data[45:])
data = data[49:] data = data[49:]
nread += 49 nread += 49
if uint32(len(data)) < 8+l*1 {
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 uint32(len(data)) < 9 {
goto overflow
}
(*a) = (data[0:])[0] (*a) = (data[0:])[0]
data = data[1:] data = data[1:]
nread += 1 nread += 1
...@@ -1888,12 +1888,12 @@ func (p *AnswerTIDList) NEODecode(data []byte) (int, error) { ...@@ -1888,12 +1888,12 @@ func (p *AnswerTIDList) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[0:]) l := binary.BigEndian.Uint32(data[0:])
data = data[4:] data = data[4:]
nread += 4 nread += 4
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a) = Tid(binary.BigEndian.Uint64(data[0:])) (*a) = Tid(binary.BigEndian.Uint64(data[0:]))
data = data[8:] data = data[8:]
nread += 8 nread += 8
...@@ -1960,12 +1960,12 @@ func (p *AnswerTIDListFrom) NEODecode(data []byte) (int, error) { ...@@ -1960,12 +1960,12 @@ func (p *AnswerTIDListFrom) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[0:]) l := binary.BigEndian.Uint32(data[0:])
data = data[4:] data = data[4:]
nread += 4 nread += 4
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a) = Tid(binary.BigEndian.Uint64(data[0:])) (*a) = Tid(binary.BigEndian.Uint64(data[0:]))
data = data[8:] data = data[8:]
nread += 8 nread += 8
...@@ -2081,12 +2081,12 @@ func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) { ...@@ -2081,12 +2081,12 @@ func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[1:]) l := binary.BigEndian.Uint32(data[1:])
data = data[5:] data = data[5:]
nread += 5 nread += 5
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a) = Oid(binary.BigEndian.Uint64(data[0:])) (*a) = Oid(binary.BigEndian.Uint64(data[0:]))
data = data[8:] data = data[8:]
nread += 8 nread += 8
...@@ -2154,15 +2154,15 @@ func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) { ...@@ -2154,15 +2154,15 @@ func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[8:]) l := binary.BigEndian.Uint32(data[8:])
data = data[12:] data = data[12:]
nread += 12 nread += 12
if uint32(len(data)) < l*12 {
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 uint32(len(data)) < 12 {
goto overflow
}
(*a).Serial = Tid(binary.BigEndian.Uint64(data[0:])) (*a).Serial = Tid(binary.BigEndian.Uint64(data[0:]))
(*a).Size = binary.BigEndian.Uint32(data[8:]) (*a).Size = binary.BigEndian.Uint32(data[8:])
data = data[12:] data = data[12:]
...@@ -2257,12 +2257,12 @@ func (p *AnswerPartitionList) NEODecode(data []byte) (int, error) { ...@@ -2257,12 +2257,12 @@ func (p *AnswerPartitionList) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[4:]) l := binary.BigEndian.Uint32(data[4:])
data = data[8:] data = data[8:]
nread += 8 nread += 8
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[0:]))) (*a).UUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
(*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[4:]))) (*a).CellState = CellState(int32(binary.BigEndian.Uint32(data[4:])))
data = data[8:] data = data[8:]
...@@ -2424,12 +2424,12 @@ func (p *AddPendingNodes) NEODecode(data []byte) (int, error) { ...@@ -2424,12 +2424,12 @@ func (p *AddPendingNodes) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[0:]) l := binary.BigEndian.Uint32(data[0:])
data = data[4:] data = data[4:]
nread += 4 nread += 4
if uint32(len(data)) < l*4 {
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 uint32(len(data)) < 4 {
goto overflow
}
(*a) = UUID(int32(binary.BigEndian.Uint32(data[0:]))) (*a) = UUID(int32(binary.BigEndian.Uint32(data[0:])))
data = data[4:] data = data[4:]
nread += 4 nread += 4
...@@ -2469,12 +2469,12 @@ func (p *TweakPartitionTable) NEODecode(data []byte) (int, error) { ...@@ -2469,12 +2469,12 @@ func (p *TweakPartitionTable) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[0:]) l := binary.BigEndian.Uint32(data[0:])
data = data[4:] data = data[4:]
nread += 4 nread += 4
if uint32(len(data)) < l*4 {
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 uint32(len(data)) < 4 {
goto overflow
}
(*a) = UUID(int32(binary.BigEndian.Uint32(data[0:]))) (*a) = UUID(int32(binary.BigEndian.Uint32(data[0:])))
data = data[4:] data = data[4:]
nread += 4 nread += 4
...@@ -2671,12 +2671,12 @@ func (p *ObjectUndoSerial) NEODecode(data []byte) (int, error) { ...@@ -2671,12 +2671,12 @@ func (p *ObjectUndoSerial) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[24:]) l := binary.BigEndian.Uint32(data[24:])
data = data[28:] data = data[28:]
nread += 28 nread += 28
if uint32(len(data)) < l*8 {
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 uint32(len(data)) < 8 {
goto overflow
}
(*a) = Oid(binary.BigEndian.Uint64(data[0:])) (*a) = Oid(binary.BigEndian.Uint64(data[0:]))
data = data[8:] data = data[8:]
nread += 8 nread += 8
...@@ -3265,12 +3265,12 @@ func (p *PartitionCorrupted) NEODecode(data []byte) (int, error) { ...@@ -3265,12 +3265,12 @@ func (p *PartitionCorrupted) NEODecode(data []byte) (int, error) {
l := binary.BigEndian.Uint32(data[4:]) l := binary.BigEndian.Uint32(data[4:])
data = data[8:] data = data[8:]
nread += 8 nread += 8
if uint32(len(data)) < l*4 {
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 uint32(len(data)) < 4 {
goto overflow
}
(*a) = UUID(int32(binary.BigEndian.Uint32(data[0:]))) (*a) = UUID(int32(binary.BigEndian.Uint32(data[0:])))
data = data[4:] data = data[4:]
nread += 4 nread += 4
......
...@@ -338,6 +338,9 @@ type decoder struct { ...@@ -338,6 +338,9 @@ type decoder struct {
// size that will be checked for overflow at current overflow check point // size that will be checked for overflow at current overflow check point
overflowCheckSize size overflowCheckSize size
// whether overflow was already checked for current decodings
overflowChecked bool
commonCoder commonCoder
} }
...@@ -493,7 +496,9 @@ func (d *decoder) genBasic(assignto string, typ *types.Basic, userType types.Typ ...@@ -493,7 +496,9 @@ func (d *decoder) genBasic(assignto string, typ *types.Basic, userType types.Typ
dataptr := fmt.Sprintf("data[%v:]", d.n) dataptr := fmt.Sprintf("data[%v:]", d.n)
decoded := fmt.Sprintf(basic.decode, dataptr) decoded := fmt.Sprintf(basic.decode, dataptr)
d.n += basic.wireSize d.n += basic.wireSize
if !d.overflowChecked {
d.overflowCheckSize.Add(basic.wireSize) d.overflowCheckSize.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
...@@ -601,50 +606,34 @@ func (d *decoder) genSlice(assignto string, typ *types.Slice, obj types.Object) ...@@ -601,50 +606,34 @@ 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.pos.num)
d.emit("%v += %v", d.var_("nread"), d.pos.num)
d.flushOverflow()
d.pos = size{} // zero
*/
d.resetPos() d.resetPos()
//d.overflowCheckpoint()
//d.pos.AddExpr("l") // FIXME l*sizeof(elem)
/*
elemSize, elemFixed := typeSizeFixed(typ.Elem()) elemSize, elemFixed := typeSizeFixed(typ.Elem())
// if size(item)==const - check l in one go // if size(item)==const - check l in one go
overflowChecked := d.overflowChecked
if elemFixed { if elemFixed {
d.emit("if len(data) < l*%v { goto overflow }", elemSize) d.overflowCheckpoint()
d.overflowCheckSize.AddExpr("l * %v", elemSize)
d.overflowChecked = true
} }
// TODO ^^^ then skip inner overflow checks
*/
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)
/* if !elemFixed {
d.flushOverflow()
d.pos = size{} // zero
*/
d.overflowCheckpoint() d.overflowCheckpoint()
}
d.resetPos() d.resetPos()
codegenType("(*a)", typ.Elem(), obj, d) codegenType("(*a)", typ.Elem(), obj, d)
/*
d.emit("data = data[%v:]", d.pos.num) // FIXME wrt slice of slice ?
d.emit("%v += %v", d.var_("nread"), d.pos.num)
*/
d.resetPos() d.resetPos()
d.emit("}") d.emit("}")
//d.overflowCheckpoint() d.overflowChecked = overflowChecked
//d.resetPos()
//d.emit("%v= string(data[:l])", assignto) //d.emit("%v= string(data[:l])", assignto)
d.emit("}") d.emit("}")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment