[SCM] Tcl interface to FITS Files branch, debian, updated. e86f557668e96918771e120433a0469265bf75ba

Ole Streicher debian at liska.ath.cx
Fri Aug 17 16:18:07 UTC 2012


The following commit has been merged in the debian branch:
commit e86f557668e96918771e120433a0469265bf75ba
Author: Ole Streicher <debian at liska.ath.cx>
Date:   Fri Aug 17 18:18:00 2012 +0200

    Replace wrong ckfree() calls by free to fix segfaults

diff --git a/debian/patches/fix_free.patch b/debian/patches/fix_free.patch
new file mode 100644
index 0000000..854f0c4
--- /dev/null
+++ b/debian/patches/fix_free.patch
@@ -0,0 +1,79 @@
+Author: Ole Streicher <debian at liska.ath.cx>
+Description: In fitsTcl_get(), the header is allocated by ffhdr2str(), but is
+ freed by ckfree(). This causes crashes if ckfree() is not just a free() alias.
+ This patch replaces these ckfree() calls, and also fixes some wrong data types.
+--- a/fitsCmds.c
++++ b/fitsCmds.c
+@@ -976,8 +976,8 @@
+       int naxis = 2;
+       long naxes[2];
+       int columns[FITS_MAXDIMS];
+-      int *nkeys;
+-      char **header;
++      int nkeys;
++      char *header;
+       int i,j;
+ 
+       /* Pan Chai: there is only 2 columns */
+@@ -1032,7 +1032,7 @@
+       }
+ 
+       status = 0;
+-      if ( ffhdr2str(dummyptr, 1, (char *)NULL, 0, &header, &nkeys, &status) > 0 ) {
++      if ( ffhdr2str(dummyptr, 1, (char **)NULL, 0, &header, &nkeys, &status) > 0 ) {
+ 	 Tcl_SetResult(curFile->interp, "Failed to collect all the headers.", TCL_STATIC);
+ 	 return TCL_ERROR;
+       }
+@@ -1049,7 +1049,7 @@
+       Tcl_ListObjAppendElement( curFile->interp, listObj, Tcl_NewListObj(5,data) );
+       Tcl_SetObjResult(curFile->interp, listObj);
+ 
+-      ckfree( (char*) header);
++      free( header);
+       return TCL_OK;
+  
+    } else if( !strcmp("translatedKeywords", argv[2]) ) {
+@@ -1075,13 +1075,14 @@
+       status = 0;
+       if (fits_copy_cell2image(curFile->fptr, newptr, argv[3], rownum, &status) > 0) 
+       {
++	  int status2 = 0;
+           ffpmsg("Failed to copy table cell to new primary array:");
+-          ffclos(curFile->fptr, status);
++          ffclos(curFile->fptr, &status2);
+           curFile->fptr = 0;              /* return null file pointer */
+           return(status);
+       }
+ 
+-      if ( ffhdr2str(newptr, 1, (char *)NULL, 0, &header, &nkeys, &status) > 0 ) {
++      if ( ffhdr2str(newptr, 1, (char **)NULL, 0, &header, &nkeys, &status) > 0 ) {
+ 	 Tcl_SetResult(curFile->interp, "Failed to collect all the headers.", TCL_STATIC);
+ 	 return TCL_ERROR;
+       }
+@@ -1102,7 +1103,7 @@
+       Tcl_SetObjResult(curFile->interp, listObj);
+ */
+ 
+-      ckfree( (char*) header);
++      free( header);
+       return TCL_OK;
+  
+    } else if( !strcmp("header2str", argv[2]) ) {
+@@ -1114,7 +1115,7 @@
+      /*                int *nkeys,         O - returned number of 80-char keywords  */
+      /*                int  *status)       IO - error status                        */
+ 
+-      if ( ffhdr2str(curFile->fptr, 1, (char *)NULL, 0, &header, &nkeys, &status) > 0 ) {
++      if ( ffhdr2str(curFile->fptr, 1, (char **)NULL, 0, &header, &nkeys, &status) > 0 ) {
+ 	 Tcl_SetResult(curFile->interp, "Failed to collect all the headers.", TCL_STATIC);
+ 	 return TCL_ERROR;
+       }
+@@ -1123,7 +1124,7 @@
+       Tcl_ListObjAppendElement( curFile->interp, listObj, Tcl_NewIntObj( nkeys ) );
+       Tcl_SetObjResult(curFile->interp, listObj);
+ 
+-      ckfree( (char*) header);
++      free( header);
+       return TCL_OK;
+  
+    } else if( !strcmp("imgwcs", argv[2]) ) {
diff --git a/debian/patches/series b/debian/patches/series
index 3e176a7..5c03b2f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ use_shared_cfitsio.patch
 cfitsio_header.patch
 fix_compiler_warnings.patch
 set_installdir.patch
+fix_free.patch

-- 
Tcl interface to FITS Files



More information about the debian-science-commits mailing list