From: MyungJoo Ham Date: Wed, 3 Apr 2019 00:48:38 +0000 (+0900) Subject: [Coverity 1050274,1050277][SVACE/414964] Array out of bound X-Git-Tag: accepted/tizen/unified/20190404.022039~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=203a7c712840a4b2f371daa217bd32312f18f822;p=platform%2Fupstream%2Fnnstreamer.git [Coverity 1050274,1050277][SVACE/414964] Array out of bound This fixes array out of bound access found by the three incidents. Signed-off-by: MyungJoo Ham --- diff --git a/gst/nnstreamer/tensor_source/tensor_src_iio.c b/gst/nnstreamer/tensor_source/tensor_src_iio.c index 29c74a6..6507a4b 100644 --- a/gst/nnstreamer/tensor_source/tensor_src_iio.c +++ b/gst/nnstreamer/tensor_source/tensor_src_iio.c @@ -484,15 +484,16 @@ gst_tensor_src_merge_tensor_by_type (GstTensorInfo * info, guint size, merge_dim = dim_idx + 1; break; } - /** No outer dimension available to merge */ - if (merge_dim > NNS_TENSOR_RANK_LIMIT) { - return size; - } } } else { return -1; } + /** No outer dimension available to merge */ + if (merge_dim >= NNS_TENSOR_RANK_LIMIT || merge_dim < 0) { + return size; + } + /** Now merge into 1 tensor using the selected dimension*/ info[0].dimension[merge_dim] = size; return 1;