Hi Carlos,

While we're at it, could I propose the attached patch instead? It does the same 
thing and a few more I did not search for the first time.

Regards,
Christophe.


----- Christophe <[email protected]> a écrit :
> Hi Rodolfo,
> 
> Could you please have a try at the patch attached below? it may (or may not) 
> solve the problem.
> 
> 
> Carlos,
> 
> Considering the nature of the patch, I'd suggest to include it anyway if its 
> fits your standards.
> 
> Regards,
> Christophe.
> 
> 
> 
> ----- Rodolfo kix Garcia <[email protected]> a écrit :
> > El 31.05.2012 18:33, Carlos R. Mafra escribió:
> > > On Thu, 31 May 2012 at 18:03:10 +0200, Rodolfo kix Garcia wrote:
> > >> El 31.05.2012 17:54, Carlos R. Mafra escribió:
> > >> >On Thu, 31 May 2012 at 17:20:30 +0200, Rodolfo kix Garcia wrote:
> > >> >>Hi,
> > >> >>
> > >> >>please, can anyone using the current next brach (updated) to check
> > >> >>if there is a bug?
> > >> >>
> > >> >>1. Launch any application
> > >> >>2. Open the properties
> > >> >>3. Click on "Reload"
> > >> >>
> > >> >>I didn't have this problem with the debian binary, but yes with my
> > >> >>developer binary at /usr/local/bin.
> > >> >
> > >> >I don't see any obvious problem with clicking the "Reload" button
> > >> >here.
> > >> >What kind of problem do you see?
> > >>
> > >> Hi Carlos,
> > >>
> > >> thanks for your reply. wmaker restarts, this is the problem:
> > >>
> > >> Program received signal SIGSEGV, Segmentation fault.
> > >
> > > Ok, I definitely can't trigger it. Can you (git) bisect this?
> > 
> > Hi Carlos,
> > 
> > I think the problem is at commit 
> > c82138eab959bc4f73b5c49de209188aab25b2a0 (Haroldo Santos's patch, in 
> > cc:).
> > (http://repo.or.cz/w/wmaker-crm.git/commitdiff/c82138eab959bc4f73b5c49de209188aab25b2a0)
> > 
> > The previous commit (wmgenmenu: Add French and Spanish translations) 
> > don't have the problem.
> > 
> > I have not time now to make a patch. I will try to check it soon (but 
> > not today), because I spent a lot of time trying to see if my new 
> > patches has bugs. If you (or Haroldo) can check it, perfect. I am busy 
> > these days :-(
> > 
> > Regards.
> > kix
> > -- 
> > ||// //\\// Rodolfo "kix" Garcia
> > ||\\// //\\ http://www.kix.es/
> > 
> > 
> > --
> > To unsubscribe, send mail to [email protected].
> 

From 2f682432cf7c4c849c8cb887c81ef00f3a0154ab Mon Sep 17 00:00:00 2001
From: Christophe CURIS <[email protected]>
Date: Thu, 31 May 2012 20:26:09 +0200
Subject: [PATCH] Fixed possible off-by-one loops

Due to variable size definitions in the structure, the 'for' loops may actually try to work on wrong data. Instead of using hard-coded value, we now simply let the compiler give us the number of element.

This may (or may not) fix a crash reported by Rodolfo kix Garcia.
---
 src/winspector.c |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/winspector.c b/src/winspector.c
index 37ae0b2..0e4b4d1 100644
--- a/src/winspector.c
+++ b/src/winspector.c
@@ -884,7 +884,7 @@ static void revertSettings(WMButton * button, InspectorPanel * panel)
 
 	wWindowSetupInitialAttributes(wwin, &level, &workspace);
 
-	for (i = 0; i < 11; i++) {
+	for (i = 0; i < (sizeof(panel->attrChk)/sizeof(panel->attrChk[0])); i++) {
 		int flag = 0;
 
 		switch (i) {
@@ -924,7 +924,7 @@ static void revertSettings(WMButton * button, InspectorPanel * panel)
 		}
 		WMSetButtonSelected(panel->attrChk[i], flag);
 	}
-	for (i = 0; i < 12; i++) {
+	for (i = 0; i < (sizeof(panel->moreChk)/sizeof(panel->moreChk[0])); i++) {
 		int flag = 0;
 
 		switch (i) {
@@ -970,7 +970,7 @@ static void revertSettings(WMButton * button, InspectorPanel * panel)
 		WMSetButtonSelected(panel->moreChk[i], flag);
 	}
 	if (panel->appFrm && wapp) {
-		for (i = 0; i < 3; i++) {
+	  for (i = 0; i < (sizeof(panel->appChk)/sizeof(panel->appChk[0])); i++) {
 			int flag = 0;
 
 			switch (i) {
@@ -1252,7 +1252,7 @@ static InspectorPanel *createInspectorForWindow(WWindow * wwin, int xpos, int yp
 	WMMoveWidget(panel->attrFrm, 15, 45);
 	WMResizeWidget(panel->attrFrm, frame_width, 250);
 
-	for (i = 0; i < 11; i++) {
+	for (i = 0; i < (sizeof(panel->attrChk)/sizeof(panel->attrChk[0])); i++) {
 		char *caption = NULL;
 		int flag = 0;
 		char *descr = NULL;
@@ -1334,13 +1334,7 @@ static InspectorPanel *createInspectorForWindow(WWindow * wwin, int xpos, int yp
 	WMMoveWidget(panel->moreFrm, 15, 45);
 	WMResizeWidget(panel->moreFrm, frame_width, 265);
 
-	for (i = 0;
-#ifdef XKB_BUTTON_HINT
-	     i < 12;
-#else
-	     i < 11;
-#endif
-	     i++) {
+	for (i = 0; i < (sizeof(panel->moreChk)/sizeof(panel->moreChk[0])); i++) {
 		char *caption = NULL;
 		int flag = 0;
 		char *descr = NULL;
@@ -1506,7 +1500,7 @@ static InspectorPanel *createInspectorForWindow(WWindow * wwin, int xpos, int yp
 		WMMoveWidget(panel->appFrm, 15, 50);
 		WMResizeWidget(panel->appFrm, frame_width, 240);
 
-		for (i = 0; i < 3; i++) {
+		for (i = 0; i < (sizeof(panel->appChk)/sizeof(panel->appChk[0])); i++) {
 			char *caption = NULL;
 			int flag = 0;
 			char *descr = NULL;
-- 
1.7.10

Reply via email to