Skip to content

Commit

Permalink
Localization: fix safety issue in base_map module
Browse files Browse the repository at this point in the history
  • Loading branch information
tthhee authored and jinghaomiao committed Aug 12, 2019
1 parent eb35e95 commit a70665e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion modules/localization/msf/local_map/base_map/base_map_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ unsigned int BaseMapNode::LoadBodyBinary(std::vector<unsigned char>* buf) {
return map_matrix_->LoadBinary(&((*buf)[0]));
}
std::vector<unsigned char> buf_uncompressed;
compression_strategy_->Decode(buf, &buf_uncompressed);
unsigned int ret = compression_strategy_->Decode(buf, &buf_uncompressed);
if (ret < 0) {
AERROR << "compression Decode error: " << ret;
return 0;
}
AERROR << "map node compress ratio: "
<< static_cast<float>(buf->size()) /
static_cast<float>(buf_uncompressed.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,11 @@ size_t BaseMapNode::LoadBodyBinary(std::vector<unsigned char>* buf) {
return map_matrix_handler_->LoadBinary(&(*buf)[0], map_matrix_);
}
std::vector<unsigned char> buf_uncompressed;
compression_strategy_->Decode(buf, &buf_uncompressed);
unsigned int ret = compression_strategy_->Decode(buf, &buf_uncompressed);
if (ret < 0) {
AERROR << "compression Decode error: " << ret;
return 0;
}
uncompressed_file_body_size_ = buf_uncompressed.size();
AINFO << "map node compress ratio: "
<< static_cast<float>(buf->size()) /
Expand Down

0 comments on commit a70665e

Please sign in to comment.