jakehilborn / displayplacer

macOS command line utility to configure multi-display resolutions and arrangements. Essentially XRandR for macOS.
MIT License
3.74k stars 134 forks source link

Segmentation fault with syntax error of space after 'origin:' #122

Open JDLH opened 1 year ago

JDLH commented 1 year ago

A command with a syntax error of a space between 'origin:' and its value results in a segmentation fault.

How to reproduce

% displayplacer "origin: (0,0)"             
zsh: segmentation fault  displayplacer "origin: (0,0)"

Observed behaviour Segmentation fault

Expected behaviour Informative error message, and a more controlled exit of the program.

Discussion I believe that it is the syntax error, rather than the incomplete set of arguments, which causes the segmentation fault.

Firstly, because the same command with the syntax error corrected results in informative error messages rather than a segmentation fault:

% displayplacer "origin:(0,0)"             
Unable to find screen  - skipping changes for that screen
Unable to find screen  - skipping changes for that screen
Unable to find screen  - skipping changes for that screen
Unable to find screen  - skipping changes for that screen
Unable to find screen  - skipping changes for that screen
Unable to find screen  - skipping changes for that screen

Secondly, because when I issued a command with full arguments which also had this syntax error, I still got the segmentation fault.