Sfoglia il codice sorgente

Fix egregious bug in decoder.push

It wasn't accounting for reserved length, so anything with a CRC or length field
was failing to decode.
Evan Huus 12 anni fa
parent
commit
97a5e22c04
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      protocol/real_decoder.go

+ 4 - 1
protocol/real_decoder.go

@@ -177,12 +177,15 @@ func (rd *realDecoder) getSubset(length int) (packetDecoder, error) {
 func (rd *realDecoder) push(in pushDecoder) error {
 	in.saveOffset(rd.off)
 
-	if rd.remaining() < in.reserveLength() {
+	reserve := in.reserveLength()
+	if rd.remaining() < reserve {
 		return DecodingError("Insufficient data while reserving for push.")
 	}
 
 	rd.stack = append(rd.stack, in)
 
+	rd.off += reserve
+
 	return nil
 }