Prevent overflow by cast in KernelGenerator of acl_cl (#9303)
author장지섭/On-Device Lab(SR)/Engineer/삼성전자 <jiseob.jang@samsung.com>
Mon, 2 Dec 2019 01:59:41 +0000 (10:59 +0900)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Mon, 2 Dec 2019 01:59:41 +0000 (10:59 +0900)
This commit prevents overflow by cast in KernelGenerator of acl_cl.

Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
runtime/neurun/backend/acl_cl/KernelGenerator.cc

index dae98fe..6a47033 100644 (file)
@@ -462,8 +462,8 @@ void KernelGenerator::visit(const model::operation::FullyConnected &node)
     const auto feature_size = _ctx.at(input_index).shape().num_elements();
 
     UNUSED_RELEASE(feature_size);
-    assert((batch_size * input_size) >= 0);
-    assert(feature_size == static_cast<uint64_t>(batch_size * input_size));
+    assert(batch_size >= 0 && input_size >= 0);
+    assert(feature_size == static_cast<uint64_t>(batch_size) * static_cast<uint64_t>(input_size));
 
     // for reshaping
     needs_reshape = true;