iraf
iraf copied to clipboard
Possible pixel bounds checking bug in imcopy
This is taken from iraf.net#1467524 from 2012-13-09 by Jason Quinn:
When I use imcopy on a
.imh
image such asdev$pix
, it reports an error if I try to copy a section that exceeds the boundary of the image:vocl> imhead dev$pix dev$pix[512,512][short]: m51 B 600s vocl> vocl> imcopy dev$pix[*,1:512] test1.fits dev$pix[*,1:512] -> test1.fits vocl> vocl> imcopy dev$pix[*,1:513] test2.fits dev$pix[*,1:513] -> test2.fits ERROR: Pixel storage file is truncated (dev$pix[*,1:513])
If however I use a FITS image, I do not get a warning for several pixels past the boundary of the image.
vocl> imcopy dev$pix jjj.fits dev$pix -> jjj.fits vocl> vocl> imhead jjj.fits jjj.fits[512,512][short]: m51 B 600s vocl> vocl> imcopy jjj.fits[*,1:512] test3.fits jjj.fits[*,1:512] -> test3.fits vocl> vocl> imcopy jjj.fits[*,1:513] test4.fits jjj.fits[*,1:513] -> test4.fits vocl> vocl> imcopy jjj.fits[*,1:514] test5.fits jjj.fits[*,1:514] -> test5.fits vocl> vocl> imcopy jjj.fits[*,1:515] test6.fits jjj.fits[*,1:515] -> test6.fits ERROR: Pixel storage file is truncated (jjj.fits[*,1:515])
Are the
[*,1:513]
and[*,1:514]
commands exposing some sort of error checking bug? The file is only 512x512.If I run fitsverify on the test image,test2.fits
andtest6.fits
give fatal errors whiletest3.fits
andtest4.fits
are valid FITS files but they have been extended by 1 and 2 pixels, respectively, in the y-direction.Also, when I try an imhead on the files I also get two different results depending on whether I use*.fits
vstest*.fits
as the argument to imhead. This seems to violate the principle of least surprise.vocl> imhead *.fits jjj.fits[512,512][short]: m51 B 600s test1.fits[512,512][short]: m51 B 600s test2.fits: FXF: EOF encountered while reading FITS file (test2.fits) test3.fits[512,512][short]: m51 B 600s test4.fits[512,513][short]: m51 B 600s test5.fits[512,514][short]: m51 B 600s test6.fits: FXF: EOF encountered while reading FITS file (test6.fits) vocl> imhead test*.fits test1.fits[512,512][short]: m51 B 600s ERROR: Seek error on file (skyfire!/home/jquinn/projects/test2.fits)
Cheers, Jason
@iraf answered:
Hi Jason,Just wanted to acknowledge that I can reproduce the problem but haven't had time to look at it in detail yet. It'll be fixed for the next update, thanks for the report.-Mike
However, in 2.16.1 (released 2013), the problem still remains.