This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: v4l2-ctl: qc.nr_of_dims is 0 for strings, check this
Author:  Hans Verkuil <hans.verk...@cisco.com>
Date:    Fri Aug 11 14:42:37 2017 +0200

The string type doesn't use dimensions, so nr_of_dims is 0 which
means that using nr_of_dims - 1 as an index in an array is a bad
idea.

Put that code under an 'if (qc.nr_of_dims)' to avoid a bus error.

Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>

 utils/v4l2-ctl/v4l2-ctl-common.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=5a67da05fded64b5f678033c16196799e134c62c
diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp 
b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index 4ca1b834602c..60624750db29 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -844,11 +844,13 @@ void common_set(int fd)
                                if (fill_subset(qc, subset))
                                        return;
 
-                               divide[qc.nr_of_dims - 1] = 1;
-                               for (d = 0; d < qc.nr_of_dims - 1; d++) {
-                                       divide[d] = qc.dims[d + 1];
-                                       for (i = 0; i < d; i++)
-                                               divide[i] *= divide[d];
+                               if (qc.nr_of_dims) {
+                                       divide[qc.nr_of_dims - 1] = 1;
+                                       for (d = 0; d < qc.nr_of_dims - 1; d++) 
{
+                                               divide[d] = qc.dims[d + 1];
+                                               for (i = 0; i < d; i++)
+                                                       divide[i] *= divide[d];
+                                       }
                                }
 
 

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to