Skip to content

Hard crash when loading file with fewer axes than CDELT entries #1769

@veggiesaurus

Description

@veggiesaurus

Describe the bug

The frontend crashes if you load an image that has spurious CDELT, CRPIX or CRVAL headers.

To Reproduce

  1. Load a file which has the following header:
SIMPLE  =                    T                                                  
BITPIX  =                  -32
NAXIS   =                    2                                                  
NAXIS1  =                10121                                                  
NAXIS2  =                10527                                                  
EXTEND  =                    T / FITS dataset may contain extensions            
CTYPE1  = 'RA---TAN'                                                            
CTYPE2  = 'DEC--TAN'                                                            
EQUINOX =                 2000                                                  
CRVAL1  =        266.366790598                                                  
CRVAL2  =       -29.2213778092                                                  
CRPIX1  =               5072.5                                                  
CRPIX2  =               5265.5                                                  
CDELT1  =         -0.000305556                                                  
CDELT2  =          0.000305556                                                  
CTYPE3  = 'FREQ    '                                                            
CRPIX3  =                  1.0                                                  
CRVAL3  =      1283895507.8125                                                  
CDELT3  =          856000000.0                                                  
CUNIT3  = 'Hz      '                                                            
CTYPE4  = 'STOKES  '                                                            
CRPIX4  =                  1.0                                                  
CRVAL4  =                  1.0                                                  
CDELT4  =                  1.0                                                  
  1. Frontend will crash in the stokesOptions computed property calculation.

Additional context
I'm not sure if the header above violates any FITS rules, but I've seen this situation before, when users trim a W x H x 1 x 1 image down to a 2D slice by just changing NAXIS entries.

I think we should at least handle this gracefully.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions