[Bugfix/Auto] Fix the bug to access freed memory region in auto fwname
authorDongju Chae <dongju.chae@samsung.com>
Fri, 12 Jun 2020 07:36:37 +0000 (16:36 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 15 Jun 2020 10:14:29 +0000 (19:14 +0900)
This patch fixes the memory bug in auto tensor filter detection.

`gst_tensor_filter_get_available_framework` assumes that `fw_name` and
`prop->fwname` are pointing different memory regions.

However, `_gtfc_setprop_Model` has passed the argument `fw_name` as
`prop->fwname`, which may cause the invalid memory access.

In this case, `fw_name` is being accessed after `prop->fwname` is freed.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
gst/nnstreamer/tensor_filter/tensor_filter_common.c

index 5154fdd..67ebfa9 100644 (file)
@@ -1038,7 +1038,7 @@ _gtfc_setprop_MODEL (GstTensorFilterPrivate * priv,
   gst_tensor_filter_parse_modelpaths_string (prop, model_files);
 
   if (prop->fwname != NULL && g_ascii_strcasecmp (prop->fwname, "auto") == 0)
-    gst_tensor_filter_get_available_framework (priv, prop->fwname);
+    gst_tensor_filter_get_available_framework (priv, "auto");
 
   /**
    * Reload model if FW has been already opened;