Re: [Freeipa-devel] [PATCH] webui: Fix coverity bugs
Commenting only on top, it's too long. ACK for everything. I've rebased patch 90. pushed to master master: * a2525ff64518038eaa64b0d855154a984030f7f3 Coverity - null pointer exception * d4ad0ca04c0ae445c784787a675ac84d2cbfd766 Coverity - null pointer exception * fa3982c7c82add3d201aec860cb981a595f10be9 Coverity - not initialized variable * de8cb7585b652fd1a61e3020e37192cb1db74f46 Coverity - identical code for different branches * 4b63ce26ebbef8ef1538aecb3cff8032df3357a7 Coverity - Accesing attribute of null * ed74e14ab4a17c83cf6782e4b6fd41a2ce79594d Coverity - removed dead code * 7be585dbb206ed12b25d09bfb2f5452ee9c125ae Coverity - true branch can't be executed * d94a2aa185defba38f2bbe2c5ee28f9b9defc0f2 Coverity - true branch can't be executed * cad9f9b682d9bcc33fdfb1112e4cfb1a2c66a498 Coverity - null pointer dereference * 4af31c70c57fc223920b71fedfb40d1de27622b2 Coverity - iterating over variable which could be null * cd74f78ed74f8898c492024d0901cef9778df067 Coverity - opens dialog which might not be created * aa8a904c4a3953e799278de192d1613d21cde42a Coverity - accessing attribute of variable which can point to null * 2644c955489ee5b22ecc0227c5cd8ed1e90ee648 Coverity - null pointer dereference On 08/05/2016 02:33 PM, Pavel Vomacka wrote: > > > On 08/01/2016 05:53 PM, Petr Vobornik wrote: >> On 07/29/2016 03:25 PM, Alexander Bokovoy wrote: >>> On Fri, 29 Jul 2016, Pavel Vomacka wrote: Hello, please review attached patches which fixes errors from Coverity. -- Pavel^3 Vomacka From 0391289b3f6844897e2a9f3ae549bd4c33233ffc Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 10:36:47 +0200 Subject: [PATCH 01/13] Coverity - null pointer exception Variable 'option' can be null and there will be error of reading property of null. --- install/ui/src/freeipa/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 9151ebac9438e9e674f81bfb1ccfe7a63872b1ae..cfdf5d4750951e4549c16a2b9b9c355f61e90c39 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -2249,7 +2249,7 @@ IPA.option_widget_base = function(spec, that) { var child_values = []; var option = that.get_option(value); -if (option.widget) { +if (option && option.widget) { child_values = option.widget.save(); values.push.apply(values, child_values); } -- 2.5.5 >>> ACK >> ACK >> From 6df8e608232e25daa9aefe4fccbdeca4dbaf1998 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 10:43:00 +0200 Subject: [PATCH 02/13] Coverity - null pointer exception Variable 'row' could be null in some cases. And set css to variable which is pointing to null causes error. Therefore there is new check. --- install/ui/src/freeipa/widget.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index cfdf5d4750951e4549c16a2b9b9c355f61e90c39..5844436abf090f12d5a9d65efe7a1aaee14097e2 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -5766,6 +5766,8 @@ exp.fluid_layout = IPA.fluid_layout = function(spec) { that.on_visible_change = function(event) { var row = that._get_row(event); +if (!row) return; + if (event.visible) { row.css('display', ''); } else { -- 2.5.5 >>> ACK >> >> ACK >> >>> From 6f2ddc9e1c5323a640bdf744d2da00bfee7ab766 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 13:48:16 +0200 Subject: [PATCH 03/13] Coverity - not initialized variable The variable hasn't been initialized, now it is set to null by default. --- install/ui/src/freeipa/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 5844436abf090f12d5a9d65efe7a1aaee14097e2..43804c5ea524ca741017d02f6e12ccf60d50b5df 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -1047,7 +1047,7 @@ IPA.multivalued_widget = function(spec) { that.child_spec = spec.child_spec; that.size = spec.size || 30; -that.undo_control; +that.undo_control = null; that.initialized = true; that.updating = false; -- 2.5.5 >>> ACK >> ACK >> >>> From b9ddd32ec45aadae5a79e372c3e1b70990071e60 Mon Sep 17 00:00:00 2001 From: Pave
Re: [Freeipa-devel] [PATCH] webui: Fix coverity bugs
Bump for review. On 08/05/2016 02:33 PM, Pavel Vomacka wrote: On 08/01/2016 05:53 PM, Petr Vobornik wrote: On 07/29/2016 03:25 PM, Alexander Bokovoy wrote: On Fri, 29 Jul 2016, Pavel Vomacka wrote: Hello, please review attached patches which fixes errors from Coverity. -- Pavel^3 Vomacka From 0391289b3f6844897e2a9f3ae549bd4c33233ffc Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 10:36:47 +0200 Subject: [PATCH 01/13] Coverity - null pointer exception Variable 'option' can be null and there will be error of reading property of null. --- install/ui/src/freeipa/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 9151ebac9438e9e674f81bfb1ccfe7a63872b1ae..cfdf5d4750951e4549c16a2b9b9c355f61e90c39 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -2249,7 +2249,7 @@ IPA.option_widget_base = function(spec, that) { var child_values = []; var option = that.get_option(value); -if (option.widget) { +if (option && option.widget) { child_values = option.widget.save(); values.push.apply(values, child_values); } -- 2.5.5 ACK ACK From 6df8e608232e25daa9aefe4fccbdeca4dbaf1998 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 10:43:00 +0200 Subject: [PATCH 02/13] Coverity - null pointer exception Variable 'row' could be null in some cases. And set css to variable which is pointing to null causes error. Therefore there is new check. --- install/ui/src/freeipa/widget.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index cfdf5d4750951e4549c16a2b9b9c355f61e90c39..5844436abf090f12d5a9d65efe7a1aaee14097e2 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -5766,6 +5766,8 @@ exp.fluid_layout = IPA.fluid_layout = function(spec) { that.on_visible_change = function(event) { var row = that._get_row(event); +if (!row) return; + if (event.visible) { row.css('display', ''); } else { -- 2.5.5 ACK ACK From 6f2ddc9e1c5323a640bdf744d2da00bfee7ab766 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 13:48:16 +0200 Subject: [PATCH 03/13] Coverity - not initialized variable The variable hasn't been initialized, now it is set to null by default. --- install/ui/src/freeipa/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 5844436abf090f12d5a9d65efe7a1aaee14097e2..43804c5ea524ca741017d02f6e12ccf60d50b5df 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -1047,7 +1047,7 @@ IPA.multivalued_widget = function(spec) { that.child_spec = spec.child_spec; that.size = spec.size || 30; -that.undo_control; +that.undo_control = null; that.initialized = true; that.updating = false; -- 2.5.5 ACK ACK From b9ddd32ec45aadae5a79e372c3e1b70990071e60 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 14:42:50 +0200 Subject: [PATCH 04/13] Coverity - identical code for different branches In both cases when the condition is true or false ut is set the same value. Changed to assign the value directly. --- install/ui/src/freeipa/topology_graph.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/ui/src/freeipa/topology_graph.js b/install/ui/src/freeipa/topology_graph.js index ce2ebeaff611987ae27f2655b5da80bdcd1b4f8a..712d38fbe67e87ffa773e0a3a1f8937e9595c9a6 100644 --- a/install/ui/src/freeipa/topology_graph.js +++ b/install/ui/src/freeipa/topology_graph.js @@ -325,8 +325,8 @@ topology_graph.TopoGraph = declare([Evented], { off = dir ? -1 : 1, // determines shift direction of curve ns = 5, // shift on normal vector s = target_count > 1 ? 1 : 0, // shift from center? -spad = d.left ? 18 : 18, // source padding -tpad = d.right ? 18 : 18, // target padding +spad = d.left = 18, // source padding +tpad = d.right = 18, // target padding sourceX = d.source.x + (spad * ux) + off * nx * ns * s, sourceY = d.source.y + (spad * uy) + off * ny * ns * s, targetX = d.target.x - (tpad * ux) + off * nx * ns * s, -- 2.5.5 ACK NACK following lines are not equivalent spad = d.left ? 18 : 18 spad = d.left = 18 same with tpad Fixed From f1f2b55247d6c7f41f8053f372a47945c93fc8a4 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 14:52:15 +0200 Subject: [PATCH 05/13] Coverity - Accesing attribute of null There is a possibility that widget is null
Re: [Freeipa-devel] [PATCH] webui: Fix coverity bugs
On 08/01/2016 05:53 PM, Petr Vobornik wrote: On 07/29/2016 03:25 PM, Alexander Bokovoy wrote: On Fri, 29 Jul 2016, Pavel Vomacka wrote: Hello, please review attached patches which fixes errors from Coverity. -- Pavel^3 Vomacka From 0391289b3f6844897e2a9f3ae549bd4c33233ffc Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 10:36:47 +0200 Subject: [PATCH 01/13] Coverity - null pointer exception Variable 'option' can be null and there will be error of reading property of null. --- install/ui/src/freeipa/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 9151ebac9438e9e674f81bfb1ccfe7a63872b1ae..cfdf5d4750951e4549c16a2b9b9c355f61e90c39 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -2249,7 +2249,7 @@ IPA.option_widget_base = function(spec, that) { var child_values = []; var option = that.get_option(value); -if (option.widget) { +if (option && option.widget) { child_values = option.widget.save(); values.push.apply(values, child_values); } -- 2.5.5 ACK ACK From 6df8e608232e25daa9aefe4fccbdeca4dbaf1998 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 10:43:00 +0200 Subject: [PATCH 02/13] Coverity - null pointer exception Variable 'row' could be null in some cases. And set css to variable which is pointing to null causes error. Therefore there is new check. --- install/ui/src/freeipa/widget.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index cfdf5d4750951e4549c16a2b9b9c355f61e90c39..5844436abf090f12d5a9d65efe7a1aaee14097e2 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -5766,6 +5766,8 @@ exp.fluid_layout = IPA.fluid_layout = function(spec) { that.on_visible_change = function(event) { var row = that._get_row(event); +if (!row) return; + if (event.visible) { row.css('display', ''); } else { -- 2.5.5 ACK ACK From 6f2ddc9e1c5323a640bdf744d2da00bfee7ab766 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 13:48:16 +0200 Subject: [PATCH 03/13] Coverity - not initialized variable The variable hasn't been initialized, now it is set to null by default. --- install/ui/src/freeipa/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 5844436abf090f12d5a9d65efe7a1aaee14097e2..43804c5ea524ca741017d02f6e12ccf60d50b5df 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -1047,7 +1047,7 @@ IPA.multivalued_widget = function(spec) { that.child_spec = spec.child_spec; that.size = spec.size || 30; -that.undo_control; +that.undo_control = null; that.initialized = true; that.updating = false; -- 2.5.5 ACK ACK From b9ddd32ec45aadae5a79e372c3e1b70990071e60 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 14:42:50 +0200 Subject: [PATCH 04/13] Coverity - identical code for different branches In both cases when the condition is true or false ut is set the same value. Changed to assign the value directly. --- install/ui/src/freeipa/topology_graph.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/ui/src/freeipa/topology_graph.js b/install/ui/src/freeipa/topology_graph.js index ce2ebeaff611987ae27f2655b5da80bdcd1b4f8a..712d38fbe67e87ffa773e0a3a1f8937e9595c9a6 100644 --- a/install/ui/src/freeipa/topology_graph.js +++ b/install/ui/src/freeipa/topology_graph.js @@ -325,8 +325,8 @@ topology_graph.TopoGraph = declare([Evented], { off = dir ? -1 : 1, // determines shift direction of curve ns = 5, // shift on normal vector s = target_count > 1 ? 1 : 0, // shift from center? -spad = d.left ? 18 : 18, // source padding -tpad = d.right ? 18 : 18, // target padding +spad = d.left = 18, // source padding +tpad = d.right = 18, // target padding sourceX = d.source.x + (spad * ux) + off * nx * ns * s, sourceY = d.source.y + (spad * uy) + off * ny * ns * s, targetX = d.target.x - (tpad * ux) + off * nx * ns * s, -- 2.5.5 ACK NACK following lines are not equivalent spad = d.left ? 18 : 18 spad = d.left = 18 same with tpad Fixed From f1f2b55247d6c7f41f8053f372a47945c93fc8a4 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 14:52:15 +0200 Subject: [PATCH 05/13] Coverity - Accesing attribute of null There is a possibility that widget is null and then there could be an error. Therefore there is new check of widget variable. --- inst
Re: [Freeipa-devel] [PATCH] webui: Fix coverity bugs
On 07/29/2016 03:25 PM, Alexander Bokovoy wrote: > On Fri, 29 Jul 2016, Pavel Vomacka wrote: >> Hello, >> >> please review attached patches which fixes errors from Coverity. >> >> -- >> Pavel^3 Vomacka >> > >> From 0391289b3f6844897e2a9f3ae549bd4c33233ffc Mon Sep 17 00:00:00 2001 >> From: Pavel Vomacka >> Date: Mon, 25 Jul 2016 10:36:47 +0200 >> Subject: [PATCH 01/13] Coverity - null pointer exception >> >> Variable 'option' can be null and there will be error of reading >> property of null. >> --- >> install/ui/src/freeipa/widget.js | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/install/ui/src/freeipa/widget.js >> b/install/ui/src/freeipa/widget.js >> index >> 9151ebac9438e9e674f81bfb1ccfe7a63872b1ae..cfdf5d4750951e4549c16a2b9b9c355f61e90c39 >> 100644 >> --- a/install/ui/src/freeipa/widget.js >> +++ b/install/ui/src/freeipa/widget.js >> @@ -2249,7 +2249,7 @@ IPA.option_widget_base = function(spec, that) { >> var child_values = []; >> var option = that.get_option(value); >> >> -if (option.widget) { >> +if (option && option.widget) { >> child_values = option.widget.save(); >> values.push.apply(values, child_values); >> } >> -- >> 2.5.5 >> > ACK ACK > >> From 6df8e608232e25daa9aefe4fccbdeca4dbaf1998 Mon Sep 17 00:00:00 2001 >> From: Pavel Vomacka >> Date: Mon, 25 Jul 2016 10:43:00 +0200 >> Subject: [PATCH 02/13] Coverity - null pointer exception >> >> Variable 'row' could be null in some cases. And set css to variable >> which is pointing to null >> causes error. Therefore there is new check. >> --- >> install/ui/src/freeipa/widget.js | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/install/ui/src/freeipa/widget.js >> b/install/ui/src/freeipa/widget.js >> index >> cfdf5d4750951e4549c16a2b9b9c355f61e90c39..5844436abf090f12d5a9d65efe7a1aaee14097e2 >> 100644 >> --- a/install/ui/src/freeipa/widget.js >> +++ b/install/ui/src/freeipa/widget.js >> @@ -5766,6 +5766,8 @@ exp.fluid_layout = IPA.fluid_layout = >> function(spec) { >> that.on_visible_change = function(event) { >> >> var row = that._get_row(event); >> +if (!row) return; >> + >> if (event.visible) { >> row.css('display', ''); >> } else { >> -- >> 2.5.5 >> > ACK ACK > > >> From 6f2ddc9e1c5323a640bdf744d2da00bfee7ab766 Mon Sep 17 00:00:00 2001 >> From: Pavel Vomacka >> Date: Mon, 25 Jul 2016 13:48:16 +0200 >> Subject: [PATCH 03/13] Coverity - not initialized variable >> >> The variable hasn't been initialized, now it is set to null by default. >> --- >> install/ui/src/freeipa/widget.js | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/install/ui/src/freeipa/widget.js >> b/install/ui/src/freeipa/widget.js >> index >> 5844436abf090f12d5a9d65efe7a1aaee14097e2..43804c5ea524ca741017d02f6e12ccf60d50b5df >> 100644 >> --- a/install/ui/src/freeipa/widget.js >> +++ b/install/ui/src/freeipa/widget.js >> @@ -1047,7 +1047,7 @@ IPA.multivalued_widget = function(spec) { >> >> that.child_spec = spec.child_spec; >> that.size = spec.size || 30; >> -that.undo_control; >> +that.undo_control = null; >> that.initialized = true; >> that.updating = false; >> >> -- >> 2.5.5 >> > ACK ACK > > >> From b9ddd32ec45aadae5a79e372c3e1b70990071e60 Mon Sep 17 00:00:00 2001 >> From: Pavel Vomacka >> Date: Mon, 25 Jul 2016 14:42:50 +0200 >> Subject: [PATCH 04/13] Coverity - identical code for different branches >> >> In both cases when the condition is true or false ut is set the same >> value. >> Changed to assign the value directly. >> --- >> install/ui/src/freeipa/topology_graph.js | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/install/ui/src/freeipa/topology_graph.js >> b/install/ui/src/freeipa/topology_graph.js >> index >> ce2ebeaff611987ae27f2655b5da80bdcd1b4f8a..712d38fbe67e87ffa773e0a3a1f8937e9595c9a6 >> 100644 >> --- a/install/ui/src/freeipa/topology_graph.js >> +++ b/install/ui/src/freeipa/topology_graph.js >> @@ -325,8 +325,8 @@ topology_graph.TopoGraph = declare([Evented], { >> off = dir ? -1 : 1, // determines shift direction of >> curve >> ns = 5, // shift on normal vector >> s = target_count > 1 ? 1 : 0, // shift from center? >> -spad = d.left ? 18 : 18, // source padding >> -tpad = d.right ? 18 : 18, // target padding >> +spad = d.left = 18, // source padding >> +tpad = d.right = 18, // target padding >> sourceX = d.source.x + (spad * ux) + off * nx * ns * s, >> sourceY = d.source.y + (spad * uy) + off * ny * ns * s, >> targetX = d.target.x - (tpad * ux) + off * nx * ns * s, >> -- >> 2.5.5 >> > ACK NACK following lines are not equivalent spad = d.left ? 18 : 18 spad = d.left = 18 same with tpad > >> From f
Re: [Freeipa-devel] [PATCH] webui: Fix coverity bugs
On Fri, 29 Jul 2016, Pavel Vomacka wrote: Hello, please review attached patches which fixes errors from Coverity. -- Pavel^3 Vomacka From 0391289b3f6844897e2a9f3ae549bd4c33233ffc Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 10:36:47 +0200 Subject: [PATCH 01/13] Coverity - null pointer exception Variable 'option' can be null and there will be error of reading property of null. --- install/ui/src/freeipa/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 9151ebac9438e9e674f81bfb1ccfe7a63872b1ae..cfdf5d4750951e4549c16a2b9b9c355f61e90c39 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -2249,7 +2249,7 @@ IPA.option_widget_base = function(spec, that) { var child_values = []; var option = that.get_option(value); -if (option.widget) { +if (option && option.widget) { child_values = option.widget.save(); values.push.apply(values, child_values); } -- 2.5.5 ACK From 6df8e608232e25daa9aefe4fccbdeca4dbaf1998 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 10:43:00 +0200 Subject: [PATCH 02/13] Coverity - null pointer exception Variable 'row' could be null in some cases. And set css to variable which is pointing to null causes error. Therefore there is new check. --- install/ui/src/freeipa/widget.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index cfdf5d4750951e4549c16a2b9b9c355f61e90c39..5844436abf090f12d5a9d65efe7a1aaee14097e2 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -5766,6 +5766,8 @@ exp.fluid_layout = IPA.fluid_layout = function(spec) { that.on_visible_change = function(event) { var row = that._get_row(event); +if (!row) return; + if (event.visible) { row.css('display', ''); } else { -- 2.5.5 ACK From 6f2ddc9e1c5323a640bdf744d2da00bfee7ab766 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 13:48:16 +0200 Subject: [PATCH 03/13] Coverity - not initialized variable The variable hasn't been initialized, now it is set to null by default. --- install/ui/src/freeipa/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 5844436abf090f12d5a9d65efe7a1aaee14097e2..43804c5ea524ca741017d02f6e12ccf60d50b5df 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -1047,7 +1047,7 @@ IPA.multivalued_widget = function(spec) { that.child_spec = spec.child_spec; that.size = spec.size || 30; -that.undo_control; +that.undo_control = null; that.initialized = true; that.updating = false; -- 2.5.5 ACK From b9ddd32ec45aadae5a79e372c3e1b70990071e60 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 14:42:50 +0200 Subject: [PATCH 04/13] Coverity - identical code for different branches In both cases when the condition is true or false ut is set the same value. Changed to assign the value directly. --- install/ui/src/freeipa/topology_graph.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/ui/src/freeipa/topology_graph.js b/install/ui/src/freeipa/topology_graph.js index ce2ebeaff611987ae27f2655b5da80bdcd1b4f8a..712d38fbe67e87ffa773e0a3a1f8937e9595c9a6 100644 --- a/install/ui/src/freeipa/topology_graph.js +++ b/install/ui/src/freeipa/topology_graph.js @@ -325,8 +325,8 @@ topology_graph.TopoGraph = declare([Evented], { off = dir ? -1 : 1, // determines shift direction of curve ns = 5, // shift on normal vector s = target_count > 1 ? 1 : 0, // shift from center? -spad = d.left ? 18 : 18, // source padding -tpad = d.right ? 18 : 18, // target padding +spad = d.left = 18, // source padding +tpad = d.right = 18, // target padding sourceX = d.source.x + (spad * ux) + off * nx * ns * s, sourceY = d.source.y + (spad * uy) + off * ny * ns * s, targetX = d.target.x - (tpad * ux) + off * nx * ns * s, -- 2.5.5 ACK From f1f2b55247d6c7f41f8053f372a47945c93fc8a4 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 14:52:15 +0200 Subject: [PATCH 05/13] Coverity - Accesing attribute of null There is a possibility that widget is null and then there could be an error. Therefore there is new check of widget variable. --- install/ui/src/freeipa/widgets/APIBrowserWidget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/widgets/APIBrowserWidget.js b/install/ui/src/freeipa/widgets/APIBrowserWidget.js index 1a3726190d4a5d62
[Freeipa-devel] [PATCH] webui: Fix coverity bugs
Hello, please review attached patches which fixes errors from Coverity. -- Pavel^3 Vomacka From 0391289b3f6844897e2a9f3ae549bd4c33233ffc Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 10:36:47 +0200 Subject: [PATCH 01/13] Coverity - null pointer exception Variable 'option' can be null and there will be error of reading property of null. --- install/ui/src/freeipa/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 9151ebac9438e9e674f81bfb1ccfe7a63872b1ae..cfdf5d4750951e4549c16a2b9b9c355f61e90c39 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -2249,7 +2249,7 @@ IPA.option_widget_base = function(spec, that) { var child_values = []; var option = that.get_option(value); -if (option.widget) { +if (option && option.widget) { child_values = option.widget.save(); values.push.apply(values, child_values); } -- 2.5.5 From 6df8e608232e25daa9aefe4fccbdeca4dbaf1998 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 10:43:00 +0200 Subject: [PATCH 02/13] Coverity - null pointer exception Variable 'row' could be null in some cases. And set css to variable which is pointing to null causes error. Therefore there is new check. --- install/ui/src/freeipa/widget.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index cfdf5d4750951e4549c16a2b9b9c355f61e90c39..5844436abf090f12d5a9d65efe7a1aaee14097e2 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -5766,6 +5766,8 @@ exp.fluid_layout = IPA.fluid_layout = function(spec) { that.on_visible_change = function(event) { var row = that._get_row(event); +if (!row) return; + if (event.visible) { row.css('display', ''); } else { -- 2.5.5 From 6f2ddc9e1c5323a640bdf744d2da00bfee7ab766 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 13:48:16 +0200 Subject: [PATCH 03/13] Coverity - not initialized variable The variable hasn't been initialized, now it is set to null by default. --- install/ui/src/freeipa/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 5844436abf090f12d5a9d65efe7a1aaee14097e2..43804c5ea524ca741017d02f6e12ccf60d50b5df 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -1047,7 +1047,7 @@ IPA.multivalued_widget = function(spec) { that.child_spec = spec.child_spec; that.size = spec.size || 30; -that.undo_control; +that.undo_control = null; that.initialized = true; that.updating = false; -- 2.5.5 From b9ddd32ec45aadae5a79e372c3e1b70990071e60 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 14:42:50 +0200 Subject: [PATCH 04/13] Coverity - identical code for different branches In both cases when the condition is true or false ut is set the same value. Changed to assign the value directly. --- install/ui/src/freeipa/topology_graph.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install/ui/src/freeipa/topology_graph.js b/install/ui/src/freeipa/topology_graph.js index ce2ebeaff611987ae27f2655b5da80bdcd1b4f8a..712d38fbe67e87ffa773e0a3a1f8937e9595c9a6 100644 --- a/install/ui/src/freeipa/topology_graph.js +++ b/install/ui/src/freeipa/topology_graph.js @@ -325,8 +325,8 @@ topology_graph.TopoGraph = declare([Evented], { off = dir ? -1 : 1, // determines shift direction of curve ns = 5, // shift on normal vector s = target_count > 1 ? 1 : 0, // shift from center? -spad = d.left ? 18 : 18, // source padding -tpad = d.right ? 18 : 18, // target padding +spad = d.left = 18, // source padding +tpad = d.right = 18, // target padding sourceX = d.source.x + (spad * ux) + off * nx * ns * s, sourceY = d.source.y + (spad * uy) + off * ny * ns * s, targetX = d.target.x - (tpad * ux) + off * nx * ns * s, -- 2.5.5 From f1f2b55247d6c7f41f8053f372a47945c93fc8a4 Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Mon, 25 Jul 2016 14:52:15 +0200 Subject: [PATCH 05/13] Coverity - Accesing attribute of null There is a possibility that widget is null and then there could be an error. Therefore there is new check of widget variable. --- install/ui/src/freeipa/widgets/APIBrowserWidget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/widgets/APIBrowserWidget.js b/install/ui/src/freeipa/widgets/APIBrowserWidget.js index 1a3726190d4a5d628a8f7c2b564c4c9f6e7cea1f..50c2989fcc126585787df61cd