[go: up one dir, main page]

Segfault in rotational gradient dialog

Siril version: current git master

Note: please report against latest git master branch or latest stable version

Operating System: [Windows? macOS? Linux?] Linux

Package: [tell us where from] compiled from git

Description of the bug

Segfault when using the "use current selection" option in the rotational gradient dialog. Console output is below:

adrian@arcturus:~/src/siril-mymaster/siril/src/algos$ siril
log: Welcome to siril v1.1.0
log: Supported file types: BMP images, PIC images (IRIS), PGM and PPM binary images, RAW images, FITS-CFA images, Films, SER sequences, TIFF images, JPG images, PNG images, HEIF images.
log: Loading init file: '/home/adrian/.config/siril/siril.config'
log: Parallel processing enabled: using 16 logical processors.
Successfully loaded '/usr/local/share/siril/siril.css'
Successfully loaded '/usr/local/share/siril/siril3.glade'
log: Setting CWD (Current Working Directory) to '/home/adrian/astro/M101/working'
log: Searching scripts in: "/usr/share/siril/scripts"...
log: Loading script: Mono_Preprocessing
log: Loading script: OSC_Extract_Ha
log: Loading script: OSC_Extract_HaOIII
log: Loading script: OSC_Preprocessing
log: Loading script: OSC_Preprocessing_WithDrizzle
scripts: Error opening directory “/home/adrian/.siril/scripts”: No such file or directory
scripts: Error opening directory “/home/adrian/siril/scripts”: No such file or directory
log: Loading registration method: One Star Registration (deep-sky)
log: Loading registration method: Two or Three Stars Registration (deep-sky)
log: Loading registration method: Global Star Alignment (deep-sky)
log: Loading registration method: Image Pattern Alignment (planetary - full disk)
log: Loading registration method: KOMBAT (planetary surfaces or full disk)
log: Loading registration method: Comet/Asteroid Registration
log: Loading registration method: Apply Existing Registration
log: Default FITS extension is set to .fit
Last available version: 1.0.2
Purging previously saved reference frame data.
log: Reading FITS: file r_bkg_ppdfdeb_LIGHT_Lagoon_61EDPH_CLS_120s_stacked.fits, 3 layer(s), 4144x2822 pixels
log: Running command: pcc
1656105372: running command pcc
log: Using target coordinate from image header: 271.220413, -23.631423
log: Photometric color correction will use plate solving first
log: Using pixel size from image: 4.630000
log: Using focal length from image: 274.000000
log: Plate solving image from an online catalogue for a field of view of 4.01 degrees, using a limit magnitude of 10.86
log: Findstar: processing for channel 0...
log: Catalog NOMAD size: 1021 objects
using min_scale 3.285424, max_scale 3.685424
using trans_order 1
atFindTrans: iter_trans unable to create a valid TRANS
initial call to atFindTrans fails
No limits set on relative scales for matching.
using trans_order 1
using trans_order 1.
Initial trans structure:
 sig=8.4658e+00 Nr=36 Nm=0 sx=0.0000e+00 sy=0.0000e+00 
TRANS based on matches only :
 sig=5.9452e+00 Nr=467 Nm=477 sx=1.7685e+00 sy=1.6212e+00 
After tuning with recalc, num matches is 486
 sig=5.9452e+00 Nr=467 Nm=486 sx=1.7685e+00 sy=1.6212e+00 
TRANS based on recalculated matches is 
 sig=6.1012e+00 Nr=473 Nm=486 sx=1.6704e+00 sy=1.6747e+00 
Transformation Matrix:
   -3.47576    -0.01548 +7227.28733
   -0.01396    +3.48167 -4770.80182
   +0.00000    +0.00000    +1.00000
log: 486 pair matches.
log: Inliers:         0.714
log: Resolution:      3.479 arcsec/px
log: Rotation:     -179.81 deg (flipped)
log: Focal length:  274.53 mm
log: Pixel size:      4.63 µm
log: Field of view:    04d 00m 15.93s x 02d 43m 37.02s
log: Image center: alpha:  18h04m53s, delta: -23°36'02"
log: Normalizing on red channel.
log: Applying aperture photometry to 580 stars.
log: 169 stars excluded from the calculation
log: Distribution of errors: no error: 1278, not in area: 18, inner radius too small: 37, pixel out of range: 114
log: Found a solution for color calibration using 411 stars. Factors:
log: K0: 1.000  (deviation: 0.000)
log: K1: 1.043  (deviation: 0.000)
log: K2: 1.227  (deviation: 0.000)
log: Background reference:
log: B0: 9.22741e-03
log: B1: 1.11975e-02
log: B2: 1.33257e-03
log: Flipping image and updating astrometry data.
Error, signal 11:
Please report this bug to: https://gitlab.com/free-astro/siril/issues
siril(+0xa931d)[0x55666e51a31d]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f302cb1e520]
siril(on_button_rgradient_selection_clicked+0x6c)[0x55666e5361dc]
/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist+0x1290)[0x7f3030fb9640]
/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit+0x93)[0x7f3030fb97a3]
/lib/x86_64-linux-gnu/libgtk-3.so.0(+0x13daa0)[0x7f303089baa0]
/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist+0x1290)[0x7f3030fb9640]
/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit+0x93)[0x7f3030fb97a3]
/lib/x86_64-linux-gnu/libgtk-3.so.0(+0x13d874)[0x7f303089b874]
/lib/x86_64-linux-gnu/libgtk-3.so.0(+0x3f0be5)[0x7f3030b4ebe5]
/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist+0x1290)[0x7f3030fb9640]
/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit+0x93)[0x7f3030fb97a3]
/lib/x86_64-linux-gnu/libgtk-3.so.0(+0x207ffc)[0x7f3030965ffc]
/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_cclosure_marshal_VOID__BOXEDv+0x96)[0x7f3030fa0866]
/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist+0x1290)[0x7f3030fb9640]
/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit+0x93)[0x7f3030fb97a3]
/lib/x86_64-linux-gnu/libgtk-3.so.0(+0x1ffacb)[0x7f303095dacb]
/lib/x86_64-linux-gnu/libgtk-3.so.0(+0x20783b)[0x7f303096583b]
/lib/x86_64-linux-gnu/libgtk-3.so.0(+0x208443)[0x7f3030966443]
/lib/x86_64-linux-gnu/libgtk-3.so.0(gtk_event_controller_handle_event+0x70)[0x7f303092cf90]
/lib/x86_64-linux-gnu/libgtk-3.so.0(+0x3a0045)[0x7f3030afe045]
/lib/x86_64-linux-gnu/libgtk-3.so.0(+0x3e6eb8)[0x7f3030b44eb8]
/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit_valist+0x1290)[0x7f3030fb9640]
/lib/x86_64-linux-gnu/libgobject-2.0.so.0(g_signal_emit+0x93)[0x7f3030fb97a3]
/lib/x86_64-linux-gnu/libgtk-3.so.0(+0x3ae724)[0x7f3030b0c724]
/lib/x86_64-linux-gnu/libgtk-3.so.0(+0x251680)[0x7f30309af680]
/lib/x86_64-linux-gnu/libgtk-3.so.0(gtk_main_do_event+0xd3a)[0x7f30309b052a]
/lib/x86_64-linux-gnu/libgdk-3.so.0(+0x39743)[0x7f3030690743]
/lib/x86_64-linux-gnu/libgdk-3.so.0(+0x70f56)[0x7f30306c7f56]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x26b)[0x7f3031241d1b]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0xaa6f8)[0x7f30312966f8]
/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x33)[0x7f303123f3c3]
/lib/x86_64-linux-gnu/libgio-2.0.so.0(g_application_run+0x1a5)[0x7f30310c7c85]
siril(main+0x132)[0x55666e4b8412]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7f302cb05d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7f302cb05e40]
siril(_start+0x25)[0x55666e4b87a5]

Reproduction

Reproduction steps:

Select a rectangle that gives a fwhm of 0.0 in the status bar at the bottom (this generally means very small rectangles). Run the command psf. If that command fails with an error, then clicking the "use current selection" box in the rotational gradient dialog will cause the program to segfault.

Expected result:

X and Y points should have been updated based on the new selection. Calculation requires psf_get_minimisation() to return a valid set of psf data but there is no check for this and if it is not true the subsequent attempts to use the result cause a segfault.

Actual result:

Segfault (output above).

Additional information

The following change fixes the bug. I haven't submitted it as a merge request as there are other approaches you could take, like just using the centre of the selection in case of no PSF being found, but this does fix the crash.

void on_button_rgradient_selection_clicked(GtkButton *button, gpointer user_data) {
	if (com.selection.h && com.selection.w) {
		psf_star *result = psf_get_minimisation(&gfit, 0, &com.selection, FALSE, FALSE, TRUE, NULL);
		if (result != NULL) {
			gchar *x0 = g_strdup_printf("%.3lf", result->x0 + com.selection.x);
			gtk_entry_set_text(GTK_ENTRY(lookup_widget("entry_rgradient_xc")), x0);
			gchar *y0 = g_strdup_printf("%.3lf", com.selection.y + com.selection.h - result->y0);
			gtk_entry_set_text(GTK_ENTRY(lookup_widget("entry_rgradient_yc")), y0);
			g_free(x0);
			g_free(y0);
			free_psf(result);
		} else {
			siril_message_dialog(GTK_MESSAGE_ERROR, _("Center coordinate selection error"),
				_("No valid PSF found within selection."));
		}
	}
}
Edited by Adrian Knagg-Baugh