gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master af2f2330: Library (fits.h): older CFITSIO vers


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master af2f2330: Library (fits.h): older CFITSIO versions correctly stored
Date: Wed, 20 Mar 2024 09:30:46 -0400 (EDT)

branch: master
commit af2f2330eaefeec24905deea3412d26955bfef9c
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Library (fits.h): older CFITSIO versions correctly stored
    
    Until now, when Gnuastro was compiled with older versions of CFITSIO (which
    had a three component version string), a 'char *' was passed to 'asprintf'
    instead of a 'char **'. This would cause a segmentation fault when Gnuastro
    was compiled with the default optimization.
    
    With this commit, the correct pointer is passed and the segmentation fault
    is fixed.
    
    This bug was reported by Giacomo Lorenzetti.
    
    This fixes bug #65494.
---
 NEWS       | 3 +++
 lib/fits.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 550dd406..40471b25 100644
--- a/NEWS
+++ b/NEWS
@@ -138,6 +138,9 @@ See the end of the file for license conditions.
   - bug #63064: Statistics crashes when all pixels are NaN. Reported by
     Raul Infante-Sainz and fixed with help of Thorsten Alteholz.
 
+  - bug #65494: Crop segmentation fault with older CFITSIOs (three word
+    version format). Reported by Giacomo Lorenzetti.
+
 
 
 
diff --git a/lib/fits.c b/lib/fits.c
index 733c2d3a..97ecbb9e 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -1779,7 +1779,7 @@ 
gal_fits_key_list_add_software_versions(gal_fits_list_key_t **keylist)
                CFITSIO_MINOR, CFITSIO_MICRO)<0 )
     error(EXIT_FAILURE, 0, "%s: asprintf allocation", __func__);
 #else
-  if( asprintf(cfitsioversion, "%d.%d", CFITSIO_MAJOR,
+  if( asprintf(&cfitsioversion, "%d.%d", CFITSIO_MAJOR,
                CFITSIO_MINOR)<0 )
     error(EXIT_FAILURE, 0, "%s: asprintf allocation", __func__);
 #endif



reply via email to

[Prev in Thread] Current Thread [Next in Thread]