CARTAvis / carta-backend

Source code repository for the backend component of CARTA, a new visualization tool designed for the ALMA, the VLA and the SKA pathfinders.
https://cartavis.github.io/
GNU General Public License v3.0
22 stars 11 forks source link

Backend crashes attempting to load LEL expression with non-existent directory as parameter #1283

Closed confluence closed 1 year ago

confluence commented 1 year ago

Describe the bug

The GUI file browser ensures that the files and directories sent in open file requests are real, but this restriction can be bypassed through the scripting interface.

Directories can either be included in the file paths used in a LEL expression, or a base directory can be specified in the directory parameter. If a non-existent directory is used in the expression, the backend fails cleanly and reports that the file doesn't exist, but if the non-existent directory is provided in the directory parameter, the backend crashes, as reported in this PR comment. I have reproduced this on Ubuntu 20.04 (it causes a segmentation fault).

To Reproduce

Steps to reproduce the behavior:

  1. Install the Python wrapper (PR #108 is about to be merged into dev); launch Python3 interpreter
  2. Launch the backend and frontend (>= 4.0 release needed for latest wrapper; enable scripting flag in backend); look in backend terminal output for URL and session ID
  3. from carta.session import Session
    session = Session.interact("PUT URL WITH TOKEN HERE", PUT_SESSION_ID_HERE)
    img = session.open_LEL_image("any expression, like image1.fits + image2.fits", directory="not_a_real_directory")
  4. Backend will crash. It should not crash if the same bad directory is included in the file path(s) in the expression.

Expected behavior

The backend should fail cleanly and report that the directory does not exist.