mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 10:40:34 +00:00
motioncells: fix splitting of RGB color string
No need to attempt splitting the RGB string in 255 tokens if we only expect 3. Left max_tokens at 4 to preserve the current logic (which allows for extra stuff at the end) and added a warning on parsing failure instead of silently discarding the value.
This commit is contained in:
parent
5515a96167
commit
77b7864670
1 changed files with 5 additions and 2 deletions
|
@ -541,10 +541,13 @@ gst_motion_cells_set_property (GObject * object, guint prop_id,
|
|||
tmply = -1;
|
||||
break;
|
||||
case PROP_CELLSCOLOR:
|
||||
colorstr = g_strsplit (g_value_get_string (value), ",", 255);
|
||||
colorstr = g_strsplit (g_value_get_string (value), ",", 4);
|
||||
for (cellscolorscnt = 0; colorstr[cellscolorscnt] != NULL;
|
||||
++cellscolorscnt);
|
||||
if (cellscolorscnt == 3) {
|
||||
if (cellscolorscnt != 3) {
|
||||
GST_WARNING_OBJECT (filter, "Ignoring badly-formatted cellscolor RGB "
|
||||
"string");
|
||||
} else {
|
||||
sscanf (colorstr[0], "%d", &r);
|
||||
sscanf (colorstr[1], "%d", &g);
|
||||
sscanf (colorstr[2], "%d", &b);
|
||||
|
|
Loading…
Reference in a new issue