2007-01-04 18:07:56

by Cyrill Gorcunov

[permalink] [raw]
Subject: [PATCH] qconf: fix SIGSEGV on empty menu items

qconf may cause SIGSEGV by trying to show debug
information on empty menu items

Signed-off-by: Cyrill V. Gorcunov <[email protected]>
---
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 0b2fcc4..0694d1d 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -925,6 +925,8 @@ ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
configSettings->endGroup();
connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings()));
}
+
+ has_dbg_info = 0;
}

void ConfigInfoView::saveSettings(void)
@@ -953,10 +955,13 @@ void ConfigInfoView::setInfo(struct menu *m)
if (menu == m)
return;
menu = m;
- if (!menu)
+ if (!menu) {
+ has_dbg_info = 0;
clear();
- else
+ } else {
+ has_dbg_info = 1;
menuInfo();
+ }
}

void ConfigInfoView::setSource(const QString& name)
@@ -991,6 +996,9 @@ void ConfigInfoView::symbolInfo(void)
{
QString str;

+ if (!has_dbg_info)
+ return;
+
str += "<big>Symbol: <b>";
str += print_filter(sym->name);
str += "</b></big><br><br>value: ";
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 6fc1c5f..a397edb 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -273,6 +273,8 @@ protected:
struct symbol *sym;
struct menu *menu;
bool _showDebug;
+
+ int has_dbg_info;
};

class ConfigSearchWindow : public QDialog {


2007-01-06 03:21:27

by Roman Zippel

[permalink] [raw]
Subject: Re: [PATCH] qconf: fix SIGSEGV on empty menu items

Hi,

On Thu, 4 Jan 2007, Cyrill V. Gorcunov wrote:

> qconf may cause SIGSEGV by trying to show debug
> information on empty menu items

Thanks, but this is more complex than necessary.
It simply lacks some initializers.

bye, Roman

Signed-off-by: Roman Zippel <[email protected]>

---
Index: linux-2.6/scripts/kconfig/qconf.cc
===================================================================
--- linux-2.6.orig/scripts/kconfig/qconf.cc 2007-01-05 01:47:54.000000000 +0100
+++ linux-2.6/scripts/kconfig/qconf.cc 2007-01-05 01:56:54.000000000 +0100
@@ -915,7 +915,7 @@ void ConfigView::updateListAll(void)
}

ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
- : Parent(parent, name), menu(0)
+ : Parent(parent, name), menu(0), sym(0)
{
if (name) {
configSettings->beginGroup(name);
@@ -951,6 +951,7 @@ void ConfigInfoView::setInfo(struct menu
if (menu == m)
return;
menu = m;
+ sym = NULL;
if (!menu)
clear();
else

2007-01-06 11:46:54

by Bauke Jan Douma

[permalink] [raw]
Subject: Re: [PATCH] qconf: fix SIGSEGV on empty menu items

Roman Zippel wrote on 06-01-07 04:20:

<snip>

> Thanks, but this is more complex than necessary.
> It simply lacks some initializers.

<snip>

> ---
> Index: linux-2.6/scripts/kconfig/qconf.cc
> ===================================================================
> --- linux-2.6.orig/scripts/kconfig/qconf.cc 2007-01-05 01:47:54.000000000 +0100
> +++ linux-2.6/scripts/kconfig/qconf.cc 2007-01-05 01:56:54.000000000 +0100
> @@ -915,7 +915,7 @@ void ConfigView::updateListAll(void)
> }
>
> ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
> - : Parent(parent, name), menu(0)
> + : Parent(parent, name), menu(0), sym(0)
> {
> if (name) {
> configSettings->beginGroup(name);
> @@ -951,6 +951,7 @@ void ConfigInfoView::setInfo(struct menu
> if (menu == m)
> return;
> menu = m;
> + sym = NULL;
> if (!menu)
> clear();
> else
> -

I can confirm that this patch squashed the segfault.

bjd