tag 716511 patch
thanks
Hi there! :-)
This is basically the same issue as #716616, just in another context:
This crash happens whenever the input file given to mincconcat somehow
indicates that it's compressed (e.g. by having an extension ".bz2",
".gz", etc.), but doesn't really contain data in the corresponding
compression format.
I've added a check for that case in order to give a reasonable error
message before exiting cleanly instead of just crashing. Please find the
patch attached. Maybe the patch can be merged with the one proposed in
#716616, given that it's basically the same fix, just in another place.
Cheers,
Martin
Description: Fix crash when input file cannot be expanded
This patch fixes a segmentation fault that occurs when an input
file has a filename extension that indicates compression (e.g.
".bz2"), but doesn't really contain content in the corresponding
compression format. In this case exit with an error message instead
of just crashing.
Author: Martin Steghöfer <mar...@steghoefer.eu>
Bug-Debian: http://bugs.debian.org/716511
--- minc-2.2.00.orig/libsrc/voxel_loop.c
+++ minc-2.2.00/libsrc/voxel_loop.c
@@ -2354,6 +2354,10 @@ PRIVATE int get_input_mincid(Loopfile_In
filename = miexpand_file(loopfile_info->input_files[file_num], NULL,
loopfile_info->headers_only,
&created_tempfile);
+ if (!filename) {
+ fprintf(stderr, "Could not expand file \"%s\"!\n", loopfile_info->input_files[file_num]);
+ exit(EXIT_FAILURE);
+ }
loopfile_info->input_mincid[index] = miopen(filename, NC_NOWRITE);
if (created_tempfile) {
(void) remove(filename);