On Sat, Sep 17, 2005 at 06:37:37PM +0200, Florian Weimer wrote:
> * Justin Pryzby:
> 
> > I was trying to load a FITS image, and I think I caused a stack smash.
> > imview should certainly protect itself against that .. it should never
> > read in more data than there is in a file (reading past the end of an
> > mmap, or such), and it should never write more data to a buffer than
> > the buffer can store.
> 
> Could you provide the image for reference, so that we can reproduce
> the bug?
You could try one of the images on my "website"; say,
http://justinpryzby.com/m27.00000001.Dumbbell_Nebula.FIT [0].

I did File / Open / All Files (*.*), and got a dialog beginning with
"format not recognized".  So I'm apparently supposed to give it hints
about where the raster image data is inside that file.  I looked at
the header of the file:

SIMPLE  =                    T / http://fits.gsfc.nasa.gov./
BITPIX  =                   16 / Bits/pixel; 2s compliment MSB (big-end) integer
NAXIS1  =                  765 / Length of axis
NAXIS2  =                  510 / Length of axis
BSCALE  =              1.00000 / Physical value = BZERO + pixel value * BSCALE
BZERO   =              32768.0 / Physical value = BZERO + pixel value * BSCALE

and so entered into the X,Y,Z Dimensions fields 765,510,1,
respectively.

It is short/MSB type data, as per BITPIX.  I don't know what
"Bands/Nb" is, so I left it at its default: Nb=1.  I set Skip=5760
because thats where the data begins.

(Compute Header wont't work for FITS, usually, because both the header
*and the data* are padded to a multiple of 2880 bytes.)

Anyway, I pressed "Try" and got a new dialog: "Coult not open
?^A, No such file or directory", followed by another dialog "Read of
<garbage here> failed, error=10".

It occurs to me that imview is probably not sufficiently general to
use FITS files.  Integer FITS data is always stored as signed, and
there are oftentimes keywords BSCALE and BZERO which must be used to
interpret the data .. a given pixel value _a_ will have the physical
value a*bscale+bzero, with units BUNITS, if specified.  Maybe you can
forward that upstream, and allow FITS to work with imview?  Or even
include full support for FITS?

-- 
Clear skies,
Justin

References

[0] A 20 minute exposure from a couple weeks ago, which includes a new
nova alongside the popular deep-sky object M27.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to