[SVACE] Fix Issue #414638
authorjijoong.moon <jijoong.moon@samsung.com>
Tue, 23 Apr 2019 09:54:01 +0000 (18:54 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Tue, 23 Apr 2019 11:21:04 +0000 (20:21 +0900)
There is svace issuse said:
WID:66310552 Return value of a function 'g_slist_nth' is dereferenced
at tensor_common.c:1096 without checking, but it is usually checked
for this function (195/205).

Add Null check.

**Self evaluation:**
1. Build test:  [X]Passed [ ]Failed [ ]Skipped
2. Run test:  [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
gst/nnstreamer/tensor_common.c

index 65dfe66..1160371 100644 (file)
@@ -1099,6 +1099,11 @@ gst_gen_tensors_from_collectpad (GstCollectPads * collect,
     GstBuffer *buf;
 
     walk = g_slist_nth (walk, sync.data_basepad.sink_id);
+    if (walk == NULL) {
+      GST_ERROR_OBJECT (collect, "Cannot get GstCollectData from GSList");
+      return FALSE;
+    }
+
     data = (GstCollectData *) walk->data;
     pad = (GstTensorCollectPadData *) data;