[CPU] Security fixes (#9009)

This commit is contained in:
Vladislav Golubev 2021-12-07 10:46:14 +03:00 committed by GitHub
parent 8ce22396b5
commit 02b1e9cf90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 28 deletions

View File

@ -526,9 +526,12 @@ void MKLDNNPlugin::MKLDNNInferRequest::changeDefaultPtr() {
break; break;
} }
if (child->getType() == Concatenation && dynamic_cast<MKLDNNConcatNode*>(child.get())->isOptimized()) { if (child->getType() == Concatenation) {
canBeInPlace = false; auto concat = dynamic_cast<MKLDNNConcatNode*>(child.get());
break; if (concat && concat->isOptimized()) {
canBeInPlace = false;
break;
}
} }
// Cannot be in-place before split because split is using different ptrs without offsets // Cannot be in-place before split because split is using different ptrs without offsets

View File

@ -39,8 +39,8 @@ private:
const int* offsetsData_ = nullptr; const int* offsetsData_ = nullptr;
const int* defaultIndices_ = nullptr; const int* defaultIndices_ = nullptr;
size_t _indicesLen; size_t _indicesLen = 0;
size_t _offsetsLen; size_t _offsetsLen = 0;
}; };
} // namespace MKLDNNPlugin } // namespace MKLDNNPlugin

View File

@ -163,25 +163,10 @@ void MKLDNNGenericNode::execLayer() {
// TODO: use ngraph-based extension mechnism if needed to recompute shape // TODO: use ngraph-based extension mechnism if needed to recompute shape
isDynBatch = false; isDynBatch = false;
// TODO: uncomment after using ngraph-based extension mechnism
// if (isDynBatch) {
// for (size_t i = 0; i < inputs.size(); i++) {
// auto td = inputs[i]->getTensorDesc();
// td.setDims(inputDescs[i].getDims());
// inputs[i] = make_blob_with_precision(td, getParentEdgeAt(i)->getMemory().GetData());
// }
// }
std::vector<InferenceEngine::Blob::Ptr> outputs; std::vector<InferenceEngine::Blob::Ptr> outputs;
for (size_t i = 0; i < outputShapes.size(); i++) { for (size_t i = 0; i < outputShapes.size(); i++) {
if (isDynBatch) { outputs.push_back(MemoryDescUtils::interpretAsBlob(getChildEdgesAtPort(i)[0]->getMemory()));
auto out_edge = getChildEdgesAtPort(i)[0];
auto td = MemoryDescUtils::convertToTensorDesc(out_edge->getMemory().getDesc());
td.setDims(execOutputShapes[i]);
outputs.push_back(make_blob_with_precision(td, out_edge->getMemory().GetData()));
} else {
outputs.push_back(MemoryDescUtils::interpretAsBlob(getChildEdgesAtPort(i)[0]->getMemory()));
}
} }
InferenceEngine::ResponseDesc resp; InferenceEngine::ResponseDesc resp;
InferenceEngine::StatusCode rc = impls[0]->execute(inputs, outputs, &resp); InferenceEngine::StatusCode rc = impls[0]->execute(inputs, outputs, &resp);

View File

@ -48,10 +48,10 @@ private:
static const size_t NMS_SELECTED_INDICES = 1; static const size_t NMS_SELECTED_INDICES = 1;
static const size_t NMS_VALID_OUTPUTS = 2; static const size_t NMS_VALID_OUTPUTS = 2;
size_t m_numBatches; size_t m_numBatches = 0;
size_t m_numBoxes; size_t m_numBoxes = 0;
size_t m_numClasses; size_t m_numClasses = 0;
size_t m_maxBoxesPerBatch; size_t m_maxBoxesPerBatch = 0;
MatrixNmsSortResultType m_sortResultType; MatrixNmsSortResultType m_sortResultType;
bool m_sortResultAcrossBatch; bool m_sortResultAcrossBatch;

View File

@ -138,7 +138,7 @@ private:
using Vmm = typename conditional3<isa == cpu::x64::sse41, Xbyak::Xmm, isa == cpu::x64::avx2, using Vmm = typename conditional3<isa == cpu::x64::sse41, Xbyak::Xmm, isa == cpu::x64::avx2,
Xbyak::Ymm, Xbyak::Zmm>::type; Xbyak::Ymm, Xbyak::Zmm>::type;
size_t vlen = cpu_isa_traits<isa>::vlen; size_t vlen = cpu_isa_traits<isa>::vlen;
bool planar_layout; bool planar_layout = false;
Xbyak::Address table_val(int index) { return ptr[reg_table + index * vlen]; } Xbyak::Address table_val(int index) { return ptr[reg_table + index * vlen]; }
@ -1136,7 +1136,7 @@ private:
using Vmm = typename conditional3<isa == cpu::x64::sse41, Xbyak::Xmm, isa == cpu::x64::avx2, using Vmm = typename conditional3<isa == cpu::x64::sse41, Xbyak::Xmm, isa == cpu::x64::avx2,
Xbyak::Ymm, Xbyak::Zmm>::type; Xbyak::Ymm, Xbyak::Zmm>::type;
size_t vlen = cpu_isa_traits<isa>::vlen; size_t vlen = cpu_isa_traits<isa>::vlen;
bool planar_layout; bool planar_layout = false;
Xbyak::Reg64 reg_dst = r8; Xbyak::Reg64 reg_dst = r8;
Xbyak::Reg64 reg_work_amount = r9; Xbyak::Reg64 reg_work_amount = r9;

View File

@ -92,7 +92,8 @@ private:
bool sort_value = false; bool sort_value = false;
bool mode_max = true; bool mode_max = true;
int dim, before_num; int dim = 0;
int before_num = 0;
std::string errorPrefix; std::string errorPrefix;