Menu

#2264 .editorconfig causes SciTE to crash if indent_size is unset and indent_style=tab

Bug
closed-fixed
nobody
scite (193)
5
2021-06-24
2021-06-14
No

Steps to reproduce:

1) Save this to a file named .editorconfig:

root = true
[*]
indent_style = tab

2) Close the file and reopen (or open another file in the same directory).

Result: SciTE crashes.

I think the problem is twofold:

  • When indent_style=tab, indent_size is set to "tab" (EditorConfig.cxx:281), which is valid but not handled (SciTEProps.cxx:1540).
  • The code calls str::stoi without handling errors (SciTEProps.cxx:1543 and :1547).

Discussion

  • Neil Hodgson

    Neil Hodgson - 2021-06-15

    The code is expecting there to be a .editorconfig setting for tab_width when indent_style = tab as the tab_width value is copied into indent_size. It seems strange to set up indentation in .editorconfig that relies on tabs but leave tab_width undefined.

    Fixed with [51a8f2].

    Added a check for when indent_style = tab and there is no tab_width to use the value of props["tabwidth"] or "8" if not set.

    Added a catch and diagnostic for stoi failure in case there are other problems.

     

    Related

    Commit: [51a8f2]

  • Neil Hodgson

    Neil Hodgson - 2021-06-24
    • status: open --> closed-fixed
     

Log in to post a comment.