Menu

#2470 dumb terminal is really bad at enhanced text

None
closed-fixed
nobody
None
2021-12-25
2021-11-03
No

Since 'set term dumb' basically acts as a character cell terminal, any markup that doesn't fit in a character cell is problematic. That includes ^ (superscript) and _ (subscript). Raising or lowering by multiple character heights is particularly bad, and in fact can cause buffer overflows as shown by the following test case found by fuzzing:

gnuplot> set term dumb enh
Terminal type is now 'dumb'
Options are 'feed enhanced size 79, 24 aspect 2, 1 mono'
gnuplot> set title "C___@____________@__________5]
gnuplot> plot x
Segmentation fault (core dumped)

Possible ways to address this:

1) Disable enhanced mode for dumb.trm, or at least go back to making it not the default. This has the disadvantage that markup characters are printed as if they were normal text.

2) Ignore _ and ^ but otherwise process enhanced text as it is now

3) Recognize and replace some common cases like ^2 with ² [U+00B2 SUPERSCRIPT TWO] but otherwise ignore _ and ^. Unicode can handle numeric super- and sub-scripts, but not other simple cases like e^x. This would at least allow scientific format for axis tic labels. However I expect it would require a lot of code for an imperfect fix.

4) Limit super- and sub-scripting to a single level. This would probably fix the segfault bug, but doesn't resolve the larger problem.

I am inclined to go with (4). Anyone have other suggestions?

Discussion

  • Ethan Merritt

    Ethan Merritt - 2021-12-02
    • status: open --> pending-fixed
    • Group: -->
    • Priority: -->
     
  • Ethan Merritt

    Ethan Merritt - 2021-12-25
    • Status: pending-fixed --> closed-fixed
     

Log in to post a comment.