This fixes array out of bound access found by the three incidents.
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
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;