Skip to content

CID 1512726: Using invalid iterator #10219

@maskit

Description

@maskit
131  std::lock_guard<std::mutex> lock(_mutex);
132
   	1. find: Calling find with element request.method returns the end iterator.
   	2. assign: Assigning: search = this->_handlers.find(request.method).
133  auto search = _handlers.find(request.method);
134
   	3. Condition search == std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, rpc::JsonRPCManager::Dispatcher::InternalHandler, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, rpc::JsonRPCManager::Dispatcher::InternalHandler> > >::const_iterator(std::end(this->_handlers)), taking false branch.
135  if (search == std::end(_handlers)) {
136    // no more checks, no handler either notification or method
137    ec = error::RPCErrorCode::METHOD_NOT_FOUND;
138    return no_handler;
139  }
140
141  // Handler's method type should match the requested method type.
   	4. Condition request->is_method(), taking true branch.
   	
CID 1512726 (#1 of 1): Using invalid iterator (INVALIDATE_ITERATOR)
5. deref_iterator: Dereferencing iterator search though it is already past the end of its container.
142  if ((request.is_method() && search->second.is_method()) || (request.is_notification() && !search->second.is_method())) {
143    return search->second;
144  }

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions