X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=httpinput.cpp;h=c346a1423ebbe938e4ee3bb7f6dfe49011bb005a;hp=19167f0b6b7404df6592dc9e9e2805bd9424325d;hb=8b466d2b206f26aedf802b06fe93ba1b67960c93;hpb=46115862ece2cbd590bc4ae6fe06767869fa7668 diff --git a/httpinput.cpp b/httpinput.cpp index 19167f0..c346a14 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -264,6 +264,7 @@ void HTTPInput::do_work() request_bytes_sent = 0; response.clear(); pending_data.clear(); + has_metacube_header = false; for (size_t i = 0; i < stream_indices.size(); ++i) { servers->set_header(stream_indices[i], "", ""); } @@ -457,6 +458,11 @@ void HTTPInput::process_data(char *ptr, size_t bytes) uint32_t size = ntohl(hdr->size); uint32_t flags = ntohl(hdr->flags); + if (size > 65535) { + log(WARNING, "[%s] Metacube block of %x bytes (flags=%x); corrupted header?", + url.c_str(), size, flags); + } + // See if we have the entire block. If not, wait for more data. if (pending_data.size() < sizeof(metacube_block_header) + size) { return; @@ -490,6 +496,7 @@ void HTTPInput::drop_pending_data(size_t num_bytes) } log(WARNING, "[%s] Dropping %lld junk bytes from stream, maybe it is not a Metacube stream?", url.c_str(), (long long)num_bytes); + assert(pending_data.size() >= num_bytes); pending_data.erase(pending_data.begin(), pending_data.begin() + num_bytes); }