bugGNU Astronomy Utilities - Bugs: bug #45380, ImageCrop crashes with long input...


You are not allowed to post comments on this tracker with your current authentication level.

bug #45380: ImageCrop crashes with long input file names

Submitter:  Mohammad Akhlaghi <makhlaghi>
Submitted:  Tue 23 Jun 2015 06:12:03 AM UTC
Category:  Crop Severity:  4 - Important
Item Group:  Crash Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Jump to the original submission

Fri 05 Aug 2016 10:46:04 PM UTC, comment #9: 

Great, thanks a lot, it is pushed to master.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 05 Aug 2016 10:21:17 PM UTC, comment #8: 

Please have a look at my "revert" branch on gitlab: https://gitlab.com/mose/gnuastro/commits/revert  In particular the commit https://gitlab.com/mose/gnuastro/commit/36f3378db9a19ba50167e75cf88df8cb06239f5a

I verified that compilation runs smoothly, all tests are passed and the command reported here and in bug #46241 doesn't cause the program to crash.

Mosè Giordano <giordano>
Group Member
Fri 05 Aug 2016 12:10:36 AM UTC, comment #7: 

Your right, thanks ;-).

Will you do it? If you are busy I am happy to revert those changes and check it.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Thu 04 Aug 2016 11:39:15 PM UTC, comment #6: 

I guess that the workaround introduced with

  * 2beb197 (2015-10-18)  Call manually the cropping functions in imgcrop

can now be reverted.

Mosè Giordano <giordano>
Group Member
Wed 03 Aug 2016 11:55:47 PM UTC, comment #5: 

This bug was fixed along with bug #46241. Please see the discussions there for the solution.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Sat 17 Oct 2015 10:57:29 PM UTC, comment #4: 

A possible way to workaround this bug could be not to define modefunction pointer and call the functions "by hand", i.e. for the single thread case something like

      else if(p->wcsmode)

but I didn't test this solution thoroughly.  I agree it's less elegant than the current implementation, but at least should avoid the crash.

Mosè Giordano <giordano>
Group Member
Sat 17 Oct 2015 04:00:18 PM UTC, comment #3: 

Ok, thank you, now I can reproduce it.  In particular, I can reproduce when compiling with -O2 and -O3, but not with -O1.

There is a problem with "p->cp.nolog": trying to printf its value before


line works flawless, right after that line the program crashes signaling a bus error.

In addition, in a gdb session executing

print p->cp.nolog

before the mentioned line returns correctly 0, but after that line I get

Cannot access memory at address 0x662e30393837367d

which is the cause of the program crashing with bus error.

Mosè Giordano <giordano>
Group Member
Sat 17 Oct 2015 07:12:17 AM UTC, comment #2: 

The problem is only on the output file name (sorry for forgetting to mention it). Running this command from the top Gnuastro directory will reproduce the problem:

./src/imgcrop/astimgcrop --xc=50 --yc=50 ./tests/1_imgcat.fits --output=qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890.fits

Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 16 Oct 2015 02:25:35 PM UTC, comment #1: 

I can't reproduce this bug, but maybe I'm missing something.  This is what I tried:

$ cd tests
$ cp imgcrop_xcyc.fits qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890.fits
$ sed -i 's/img=mkprofcat1.fits/img=qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890.fits/' imgcrop/xcyc.sh
$ ./imgcrop/xcyc.sh

and astimgcrop didn't crash.

Mosè Giordano <giordano>
Group Member
Tue 23 Jun 2015 06:12:03 AM UTC, original submission:  

When compiled with optimization flags, if the file names are longer than 50 to 50 characters, then for some reason, ImageCrop gives a segmentation fault on p->cp.dontdelete!

p->cp.dontdelete can be read and changed (accessed) within the cropping function (tested here in the image mode), but as soon as control comes to the main imgcrop function (prior to going into the printlog function) it is not accessible any more and trying to read or write to it causes a segmentation fault.

Mohammad Akhlaghi <makhlaghi>
Group administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by giordano (Posted a comment)
  • -email is unavailable- added by makhlaghi (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-03 makhlaghi StatusPostponed Fixed
        Open/ClosedOpen Closed
    2015-10-15 makhlaghi Assigned tomakhlaghi None

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code