// 0 element refers to client frame, 1 element refers to server frame
- // There is currently one infraction and one event object per flow per direction.
+ // There are currently one infraction and one event object per flow per direction.
Http2Infractions* const infractions[2] = { new Http2Infractions, new Http2Infractions };
Http2EventGen* const events[2] = { new Http2EventGen, new Http2EventGen };
uint32_t frame_header_offset[2] = { 0, 0 };
uint32_t frame_data_offset[2] = { 0, 0 };
uint32_t remaining_frame_octets[2] = { 0, 0 };
+ uint32_t running_total[2] = { 0, 0 };
uint8_t remaining_padding_reassemble[2] = { 0, 0 };
bool read_frame_header[2] = { false, false };
bool continuation_frame[2] = { false, false };
unsigned total, unsigned offset, const uint8_t* data, unsigned len, uint32_t flags,
HttpCommon::SourceId source_id)
{
-
StreamBuffer frame_buf { nullptr, 0 };
- if ( offset+len > total || total != session_data->bytes_scanned[source_id])
+ if ((session_data->running_total[source_id] != offset) ||
+ (total != session_data->bytes_scanned[source_id]) ||
+ (offset+len > total) ||
+ ((flags & PKT_PDU_TAIL) && (offset+len != total)))
{
assert(false);
session_data->abort_flow[source_id] = true;
return frame_buf;
}
+ session_data->running_total[source_id] += len;
if (session_data->frame_type[source_id] == FT_DATA)
{
// but don't create pkt_data buffer
frame_buf.data = (const uint8_t*)"";
}
+ session_data->running_total[source_id] = 0;
session_data->bytes_scanned[source_id] = 0;
}