Skip to content

Commit

Permalink
Ensure only non-zero-sized pages get coalesced and analyzed
Browse files Browse the repository at this point in the history
  • Loading branch information
david415 committed Apr 3, 2015
1 parent d2b775e commit 2fc9e1a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ordered_coalesce.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (o *OrderedCoalesce) insert(packetManifest PacketManifest, nextSeq types.Se
panic("wtf")
}

// ignore useless packets
// XXX for now we ignore zero size packets
if len(packetManifest.Payload) == 0 {
return nextSeq
}
Expand Down Expand Up @@ -275,7 +275,7 @@ func (o *OrderedCoalesce) addNext(nextSeq types.Sequence) types.Sequence {
log.Print("zero length ordered coalesce packet not added to ring buffer\n")
return nextSeq
}
if o.DetectCoalesceInjection {
if o.DetectCoalesceInjection && len(o.first.Bytes) > 0 {
// XXX stream segment overlap condition
if diff < 0 {
p := PacketManifest{
Expand All @@ -294,9 +294,12 @@ func (o *OrderedCoalesce) addNext(nextSeq types.Sequence) types.Sequence {
}
}
o.first.Bytes, nextSeq = byteSpan(nextSeq, o.first.Seq, o.first.Bytes) // XXX injection happens here

// append reassembly to the reassembly ring buffer
o.StreamRing.Reassembly = &o.first.Reassembly
o.StreamRing = o.StreamRing.Next()
if len(o.first.Reassembly.Bytes) > 0 {
o.StreamRing.Reassembly = &o.first.Reassembly
o.StreamRing = o.StreamRing.Next()
}

reclaim := o.first
if o.first == o.last {
Expand Down

0 comments on commit 2fc9e1a

Please sign in to comment.