From: Steinar H. Gunderson Date: Sun, 8 Feb 2015 00:32:21 +0000 (+0100) Subject: Fix another crippling RS decoding bug. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=34fe2a0994015dc72813e2315fbd67b1b648e23c;hp=25ec76e42888b1d8cdae77b31d9209efdbe3a410;p=greproxy Fix another crippling RS decoding bug. --- diff --git a/rsdecoder.cpp b/rsdecoder.cpp index 8a27896..9ba69a5 100644 --- a/rsdecoder.cpp +++ b/rsdecoder.cpp @@ -95,13 +95,18 @@ void RSDecoder::send_packet(uint16_t proto, const std::string &data, int incomin const auto it = group.packets.find(packet_num); if (it == group.packets.end()) { missing_packets.push_back(i); - } else { + } else if (i < RS_PAYLOAD_SIZE) { + // Regular packet. const GREPacket &packet = it->second; uint16_t proto_be = htons(packet.proto); memcpy(&p[0], &proto_be, sizeof(uint16_t)); uint16_t len_be = htons(packet.data.size()); memcpy(&p[2], &len_be, sizeof(uint16_t)); memcpy(&p[4], packet.data.data(), packet.data.size()); + } else { + // RS packet. + const GREPacket &packet = it->second; + memcpy(&p[0], packet.data.data(), packet.data.size()); } padded_packets.push_back(p); }