[SVACE/414609] Fix 65505016 Warning
authorMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 1 Apr 2019 07:25:22 +0000 (16:25 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 1 Apr 2019 10:45:48 +0000 (19:45 +0900)
Line 249 of tensordec-boundingbox.c has the following SVACE warning:

Warning Message
Possible integer underflow: left operand is tainted. An integer underflow may occur due to arithmetic operation (unsigned subtraction) between values { [0, 1073741823] } and '1', where the first value comes from the expression 'strlen(line)'

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
ext/nnstreamer/tensor_decoder/tensordec-boundingbox.c

index f233211..d4f208a 100644 (file)
@@ -245,7 +245,7 @@ loadImageLabels (bounding_boxes * data)
     GList *labels = NULL, *cursor;
 
     while ((read = getline (&line, &len, fp)) != -1) {
-      if (line) {
+      if (line && strlen (line) >= 1) {
         if (line[strlen (line) - 1] == '\n') {
           line[strlen (line) - 1] = '\0';
         }