gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 6fa32bd: Library (fits): won't crash when WCS


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 6fa32bd: Library (fits): won't crash when WCS can't be written
Date: Mon, 1 Apr 2019 12:58:28 -0400 (EDT)

branch: master
commit 6fa32bdf297f084940e574516f4c636f947c5bbc
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Library (fits): won't crash when WCS can't be written
    
    Until now, when WCSLIB's `wcshdo' function failed, the program would
    crash. With this commit, it will just print a warning that the WCS couldn't
    be written.
    
    This issue was found based on a dataset provided by Javier Román.
---
 NEWS                         | 1 +
 doc/announce-acknowledge.txt | 1 +
 lib/fits.c                   | 9 ++++++---
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 778b1b7..d7c6cbe 100644
--- a/NEWS
+++ b/NEWS
@@ -196,6 +196,7 @@ See the end of the file for license conditions.
   bug #55845: Crash when necessary column not found from standard input.
   bug #55988: MakeProfiles segfault when input catalog has no rows.
   bug #56001: Bad tile sizes with only one tile and small remainder.
+  bug #56048: Crash when WCS cannot be written to FITS file.
 
 
 
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 006eb85..e9076c7 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -5,5 +5,6 @@ Leindert Boogaard
 Elham Eftekhari
 Raúl Infante Sainz
 Lee Kelvin
+Javier Román
 David Valls-Gabaud
 Ignacio Trujillo
diff --git a/lib/fits.c b/lib/fits.c
index 91a2115..dd2d3bf 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -2092,9 +2092,12 @@ gal_fits_img_write_to_ptr(gal_data_t *input, char 
*filename)
       /* Convert the WCS information to text. */
       status=wcshdo(WCSHDO_safe, towrite->wcs, &nkeyrec, &wcsstr);
       if(status)
-        error(EXIT_FAILURE, 0, "%s: wcshdo ERROR %d: %s", __func__,
-              status, wcs_errmsg[status]);
-      gal_fits_key_write_wcsstr(fptr, wcsstr, nkeyrec);
+        error(0, 0, "%s: WARNING: WCSLIB error, no WCS in output.\n"
+              "wcshdu ERROR %d: %s", __func__, status,
+              wcs_errmsg[status]);
+      else
+        gal_fits_key_write_wcsstr(fptr, wcsstr, nkeyrec);
+      status=0;
     }
 
   /* Report any errors if we had any */



reply via email to

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