[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

please consider geda 20050313-2



Hi,

geda 20050313-2 includes an upstream fix for grave bug #308489
(a segfault). In addition I fixed a trivial normal bug -- added
one package to the Suggests line (bug #274074).

That first bug doesn't really deserve to be grave, but on the other hand
the segfault occurs in the major codepath meaning that the application
is pretty unusable as-is.

debdiff below. Would you please consider this for sarge?

thanks,
Hamish


diff -u geda-20050313/debian/changelog geda-20050313/debian/changelog
--- geda-20050313/debian/changelog
+++ geda-20050313/debian/changelog
@@ -1,3 +1,12 @@
+geda (20050313-2) unstable; urgency=high
+
+  * Applied patch from upstream CVS to src/task.c to fix
+    segfaults trying to open schematics (closes: #308489)
+    (Bug is 'grave' so urgency=high)
+  * Added suggests: for gerbv (closes: #274074)
+
+ -- Hamish Moffatt <hamish@debian.org>  Sun, 15 May 2005 23:24:33 +1000
+
 geda (20050313-1) unstable; urgency=low
 
   * New upstream release
diff -u geda-20050313/debian/control geda-20050313/debian/control
--- geda-20050313/debian/control
+++ geda-20050313/debian/control
@@ -8,7 +8,7 @@
 Package: geda
 Architecture: any
 Depends: geda-gschem, geda-gnetlist, geda-doc, ${shlibs:Depends}
-Suggests: geda-utils, geda-gsymcheck, geda-examples, geda-gattrib
+Suggests: geda-utils, geda-gsymcheck, geda-examples, geda-gattrib, gerbv
 Description: GNU EDA -- Electronics design software
  GNU EDA, an electronics design package, including
  gschem, a schematic editor.
only in patch2:
unchanged:
--- geda-20050313.orig/src/task.c
+++ geda-20050313/src/task.c
@@ -1,4 +1,4 @@
-/* $Id: task.c,v 1.6 2005/02/22 22:45:14 danmc Exp $ */
+/* $Id: task.c,v 1.7 2005/05/11 03:27:11 ahvezda Exp $ */
 
 /*******************************************************************************/
 /*                                                                             */
@@ -70,7 +70,7 @@
 static int NewIntCmd(const char *szFilename, struct Action_s *pAction);
 static int NewExtCmd(const char *szFilename, struct Action_s *pAction);
 static int NewImport(const char *szFilename, struct Action_s *pAction);
-static void StrReplace(char *szString, const char *szFrom, const char *szTo);
+static char* StrReplace(char *szString, const char *szFrom, const char *szTo);
 
 
 
@@ -411,10 +411,10 @@
 		return FAILURE;
 	}
 	strcpy(pTask->szValue, pAction->szCommand);
-	StrReplace((char *) pTask->szValue, "%FILENAME%", (char *) FileGetName(szFilename));
-	StrReplace((char *) pTask->szValue, "%FILEEXT%", (char *) FileGetExt(szFilename));
-	StrReplace((char *) pTask->szValue, "%FILEDIR%", (char *) FileGetDir(szFilename));
-	StrReplace((char *) pTask->szValue, "%FILEREL%", (char *) FileGetRel(szFilename));
+	pTask->szValue = StrReplace((char *) pTask->szValue, "%FILENAME%", (char *) FileGetName(szFilename));
+	pTask->szValue = StrReplace((char *) pTask->szValue, "%FILEEXT%", (char *) FileGetExt(szFilename));
+	pTask->szValue = StrReplace((char *) pTask->szValue, "%FILEDIR%", (char *) FileGetDir(szFilename));
+	pTask->szValue = StrReplace((char *) pTask->szValue, "%FILEREL%", (char *) FileGetRel(szFilename));
 		
 	/* display message box if task blocking */
 	if (pTask->fFlags & TASK_BLOCKING)
@@ -479,10 +479,10 @@
 		return FAILURE;
 	}
 	strcpy(pTask->szValue, pAction->szImport);
-	StrReplace((char *) pTask->szValue, "%FILENAME%", (char *) FileGetName(szFilename));
-	StrReplace((char *) pTask->szValue, "%FILEEXT%", (char *) FileGetExt(szFilename));
-	StrReplace((char *) pTask->szValue, "%FILEDIR%", (char *) FileGetDir(szFilename));
-	StrReplace((char *) pTask->szValue, "%FILEREL%", (char *) FileGetRel(szFilename));
+	pTask->szValue = StrReplace((char *) pTask->szValue, "%FILENAME%", (char *) FileGetName(szFilename));
+	pTask->szValue = StrReplace((char *) pTask->szValue, "%FILEEXT%", (char *) FileGetExt(szFilename));
+	pTask->szValue = StrReplace((char *) pTask->szValue, "%FILEDIR%", (char *) FileGetDir(szFilename));
+	pTask->szValue = StrReplace((char *) pTask->szValue, "%FILEREL%", (char *) FileGetRel(szFilename));
 			
 	pTask->pMenuItem = MenuWindowNew(pAction->szName);
 	pTask->Id = 0;
@@ -503,14 +503,14 @@
 
 
 
-static void StrReplace(char *szString, const char *szFrom, const char *szTo)
+static char* StrReplace(char *szString, const char *szFrom, const char *szTo)
 {
 	char *szBegin, *szTemp;
 	int i;
 	
 	szTemp = (void *) malloc(strlen(szString) + 1);
 	if (szTemp == NULL)
-		return;
+		return NULL;
 	
 	for (szBegin = strstr(szString, szFrom); szBegin != NULL; szBegin = strstr(szString, szFrom))
 	{
@@ -520,11 +520,18 @@
 		
 		strcpy(szString, szTemp);
 		szString[i] = 0;
-		
-		realloc(szString, strlen(szString) + strlen(szTo) + strlen(szBegin + strlen(szFrom)) + 1);
+	
+                /* realloc can change the modified pointer completely, so */
+                /* it needs to be assigned.  Not doing this caused a nasty */
+                /* bug on some architectures/machines. */	
+		szString = realloc(szString, strlen(szString) + strlen(szTo) + strlen(szBegin + strlen(szFrom)) + 1);
 		strcat(szString, szTo);
 		strcat(szString, szBegin + strlen(szFrom));
 	}
 	
 	free((void *) szTemp);
+
+        /* You must return the pointer since realloc might have completely */
+        /* changed the pointer. */
+        return szString;
 }
-- 
Hamish Moffatt VK3SB <hamish@debian.org> <hamish@cloud.net.au>



Reply to: