1
0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-11-27 08:25:47 +01:00

Add debug for catching issue 'We tried to access outsize allocated vector'

This commit is contained in:
Pavel Odintsov 2015-01-23 12:54:41 +03:00
parent beacb61cf0
commit f62c19d80b

@ -1355,7 +1355,11 @@ void process_packet(simple_packet& current_packet) {
uint32_t shift_in_vector = ntohl(current_packet.src_ip) - subnet_in_host_byte_order; uint32_t shift_in_vector = ntohl(current_packet.src_ip) - subnet_in_host_byte_order;
if (shift_in_vector >= itr->second.size()) { if (shift_in_vector >= itr->second.size()) {
logger<< log4cpp::Priority::ERROR<<"We tried to access outsize allocated vector!"; logger<< log4cpp::Priority::ERROR<<"We tried to access to element with index "<<shift_in_vector
<<"which located outside allocated vector with size "<<itr->second.size();
logger<< log4cpp::Priority::INFO<<"We expect issues with this packet in OUTGOING direction: "<<print_simple_packet(current_packet);
return; return;
} }
@ -1429,7 +1433,11 @@ void process_packet(simple_packet& current_packet) {
uint32_t shift_in_vector = ntohl(current_packet.dst_ip) - subnet_in_host_byte_order; uint32_t shift_in_vector = ntohl(current_packet.dst_ip) - subnet_in_host_byte_order;
if (shift_in_vector >= itr->second.size()) { if (shift_in_vector >= itr->second.size()) {
logger<< log4cpp::Priority::ERROR<<"We tried to access outsize allocated vector!"; logger<< log4cpp::Priority::ERROR<<"We tried to access to element with index "<<shift_in_vector
<<"which located outside allocated vector with size "<<itr->second.size();
logger<< log4cpp::Priority::INFO<<"We expect issues with this packet in INCOMING direction: "<<print_simple_packet(current_packet);
return; return;
} }