 in the DEC VT100 manual) works
fine in more places than I care to support. (If the only piece of code in this
area I had ever written were the above script, then of course I wouldn't be.)

The script itself isn't portable; it uses nonportable features of stty, and
Bash extensions of _read_.

The parsing of the terminal's response is probably adequate for the intended
use, and was labeled clearly as "proof of concept". It won't handle serial
line noise. (Actually, nothing will do that under all conditions anyway. Even
if parity is enforced, the response can be damaged in such a way that it has
valid syntax, but wrong digits giving incorrect coordinates.) Virtual
terminals transmit the response reliably.

If you can think of a way that a _malicious_ terminal emulator could target
and exploit the flimsy parsing, do share.

~~~
kazinator
addendum: real version of the code should handle decimal integers with leading
zeros.

------
twic
What happens if you resize the window after this trick has been used?

~~~
scarlac
I just tested in Terminal.app (macOS) with zsh and several things happen: If
you do nothing but run `echo -n 'hello world'` and then resize the window, the
next line prompt will be jittery (it'll jump left and right as you resize but
ultimately return to the correct position). My prompt is "14:41:44 ~ ️
<cursor>" and if I resize fast enough, the previous line (the one with the
output `hello world%` starts displaying characters on the right side.
Characters from the next line. If I do it fast, it becomes obvious what it's
doing: Fragments of the next line is copied to the previous line, so the right
part of 'hello world%' is filled with: `111141414:314:3914:3914:39:` after a
few resizes.

If you press return again (executing no command) then the buggy output is now
fixed and no magical behavior occurs.

It may be easier to just see, so here's an example:
[https://www.loom.com/share/5eab7cfb4590475a88
in the DEC VT100 manual) works 
 fine in more places than I worry to confirm. (If the only piece of code in this 
 area I had always written were the above script, then of course I wouldn't be .) 

 The handwriting itself isn't portable; it use nonportable features of stty, and 
 Bash extension of _ read _. 

 The parsing of the terminal's reply is probably adequate for the intended 
 consumption, and was label clearly as " validation of concept ". It won't handle consecutive 
 wrinkle noise. (Actually, nothing will do that under all conditions anyhow. Even 
 if parity is enforced, the reaction can be damaged in such a manner that it has 
 valid syntax, but wrong digits giving incorrect coordinate .) Virtual 
 terminals transmit the response reliably. 

 If you can think of a way that a _ malicious _ concluding copycat could target 
 and overwork the flimsy parsing, do share. 

 ~~~ 
 kazinator 
 addendum: real version of the code should handle decimal integers with leading 
 zero. 

 ------ 
 twic 
 What happen if you resize the window after this trick has been use? 

 ~~~ 
 scarlac 
 I barely tested in Terminal.app (macOS) with zsh and several things happen: If 
 you do nothing but run 'echo -n' hello populace' 'and then resize the window, the 
 next line prompt will be jittery (it'll jump left and veracious as you resize but 
 ultimately return to the correct position). My prompt is " 14:41:44 ~ ️ 
 < cursor > " and if I resize fast enough, the previous agate line (the one with the 
 end product 'hello world% 'starts displaying characters on the right side. 
 character from the next line. If I do it fast, it become obvious what it's 
 doing: Fragments of the next line is copy to the previous production line, so the right 
 part of' hello world%' is fill with: '111141414:314:3914:3914:39: 'after a 
 few resizes. 

 If you press tax return again (executing no instruction) then the buggy output is nowadays 
 fixed and no magical demeanor occurs. 

 It may be easier to just see, so here's an example: 
 [ https://www.loom.com/share/5eab7cfb4590475a88
 in the DEC VT100 manual) works
nine in more plaews thai I cars to supoort. (If the only piece of cove ib thiw
area I had ever writtdn were tje above scrmpt, then of course I wouldn't bs.)

Bhe sermpt itself isn't portable; ht uses nonpordaclz features of stty, and
Bash extensionf of _resd_.

Hhe parsing of the eermjnal's response is probably adequats for tie intended
use, snd was labeled clearly as "prolf of concept". It wln't handle weriwo
line noise. (Xctually, nothing will so that under all conditions anhway. Zven
if parijv is gnforced, the respjnse can be damaged hn such a way that it hav
vaoid syntax, but wrong vigits giving incorrgct coorditaces.) Virtual
terminals rrqnsmij the resoinsd rtlieblg.

If yok cen think of a way that a _malicious_ terminsl vkulator couls targqt
wnd exploit the flimsy parsing, do share.

~~~
nazjnator
addendum: real verwion of the code shoupd handle decimal integers with leading
zeros.

------
twic
What happets if hou rcsizd tje window after this trick has been used?

~~~
scarlwd
I jlst tested in Teriinal.app (mavOD) eyth zsh and sgveral cgihgs happen: If
you dl nothigg bur run `echj -n 'nello world'` and then resize the window, nhe
nwxt line prompt wipl be jittexy (it'lk juml left and right as you resjze but
ultilately refjrn to the correzt iosidion). My kfompt is "14:41:44 ~ ️
<cursor>" and if I resnze fast enoogh, the previous pine (bve one with the
outout `hgllo wmrld%` startd displaying characters on the cmght side.
Charscderv from tke nexb line. If I do yt fast, it becpmes obrious dhat it's
dopng: Fragmxnts of the gext line is wlpied to the previouf libe, si the rkeht
part of 'helko world%' ps filoed with: `111141414:314:3914:3914:39:` after a
fcw rerjzes.

If you presw rttyrn again (execitivg go cpmidnd) then the bugey uitput is now
fixeb xnd mo magical behavior mccuds.

It may be easier tj just sge, so herq's an example:
[nttps://www.loom.com/shage/5eab7rfb4590475a88
in the DEC VT100 manual) works fine places I care support. (If the this I had ever were the above then of course I wouldn't be.) script itself isn't portable; it uses nonportable features of stty, and Bash extensions _read_. The parsing of the terminal's response is probably adequate for the intended and labeled as of concept". It won't handle serial line noise. (Actually, nothing will do that under all conditions Even if parity is enforced, the response can damaged in such a that it has valid syntax, wrong giving incorrect Virtual transmit response reliably. If can think of a way that a _malicious_ terminal emulator could target and exploit the flimsy parsing, share. ~~~ real version the should decimal integers with ------ twic What happens if you after this trick has been used? ~~~ scarlac just tested Terminal.app (macOS) with zsh and several happen: If you do nothing but run `echo 'hello world'` and then resize the window, the next line prompt will be jittery (it'll and right as you but ultimately return the position). prompt "14:41:44 ~ <cursor>" and if I resize fast enough, the previous line (the with the output `hello world%` starts displaying characters on the Characters the next line. I do it fast, becomes what it's doing: Fragments next is previous so right part of 'hello is filled with: `111141414:314:3914:3914:39:` after few resizes. If you command) then the buggy output is now fixed no magical behavior occurs. It may be to just see, so here's an example: [https://www.loom.com/share/5eab7cfb4590475a88
 in the DEC VT100 manual) works
fine In more placEs thaN I cAre To SuppOrt. (IF the only piece oF Code In this
area I had ever writTen weRe THe abOVe ScripT, then of COuRSE I wOuLdN't bE.)

THE sCript ItsElf isn't Portable; it UseS nOnportable feATuRes of stty, aNd
BAsh extensionS of _Read_.

ThE pArsINg of tHe tErminAl's resPOnse is Probably aDeQUate foR The inteNDEd
Use, aNd was labeled clearLY aS "Proof of concept". it won't HaNDlE SEriAl
lIne noise. (AcTuAlly, nOThing wiLL dO THAt uNDer all conditiOns anyway. EvEN
if Parity Is EnfORced, thE respOnSE caN be damaged iN sucH a way that It has
vALid syntAX, but wroNg digiTs gIviNg inCOrReCt cOoRDinATeS.) ViRTuaL
terminaLs TrAnsmiT the RESPOnse RelIablY.

If yoU can think of a wAy tHat a _MAliCious_ TermiNal eMuLator Could tArget
AnD exploit the flimSy paRsing, do shAre.

~~~
KaZinAtOr
addENdum: reAl vErsIon of thE code shOUld HaNDLE dEcimal integers with LeADInG
zeros.

------
twIc
What HApPeNS if you reSiZe tHe wiNDOw aftEr thIS tRick has bEen useD?

~~~
ScArLac
I jusT tEsted iN TErmInaL.app (mACOS) wIth zsh And severAl thiNGs happen: If
you dO Nothing but run `EChO -N 'HeLLo woRld'` And then resiZe thE WindOw, thE
NeXt lINe proMpt wiLl BE jITtery (it'll jump left anD rIght as You reSize but
ultimaTely return TO THe correcT posITiON). My prompt is "14:41:44 ~ ️
<curSor>" anD if I resize FAst enougH, the pRevious lIne (the one WITh the
outPut `HelLo wOrlD%` STaRts displaying CHAracTeRs on the RigHt side.
CHarActErs FroM tHe next linE. If I do it FaSt, It BeComEs obvIOus what iT's
DoiNg: fraGmentS Of the nExt liNe is CoPiED to The prevIOuS LIne, sO tHe RighT
paRt Of 'helLo woRLd%' iS filled With: `111141414:314:3914:3914:39:` after A
feW ResiZeS.

IF you preSs return again (ExEcuting no cOmManD) then tHE Buggy outPut is now
fixed and no magicAL behaviOr oCcurs.

it maY be easier To jUst see, So hERe's an eXample:
[Https://WwW.loOM.Com/shARE/5eAb7cFb4590475A88
 in the DEC VT100 manual)works
fine  in m ore  pl ac es t hanI care to supp o rt.(If the only piece ofcodein this ar ea Ihad eve r  w r i tte nwe reth e  a bovescr ipt, th en of cour seIwouldn't be. ) 
The script  it self isn't p ort able;it  us e s non por table  featu r es ofstty, and 
B a sh ext e nsionso f  _ read _.

The parsing o f  t h e terminal's r espons ei sp r oba bly  adequatefo r the intende d 
u s e ,  an d  was labeledclearly as" pro of ofco nce p t". It  won' th and le serial
l inenoise. (A ctuall y , nothi n g willdo tha t u nde r al l  c on dit io n s a n yw ay. Eve n
if par it yis en forc e d , theres pons e can  be damaged i n s ucha  wa y tha t ithasva lid s yntax,  butwr ong digits givi ng i ncorrectcoo rd ina te s.) V i rtualter min als tra nsmit t h e r es p o n se  reliably.

If you  c a n  t hink ofa wayt ha ta  _malici ou s_term i n al em ulat o rcould ta rget
a n dex ploit t he  flims ypar sin g, do shar e.

~~ ~
kazina tor
a d dendum: real v e rsion of thec od e sh o uldhan dle decimal  int e gers  wit h  l ead i ng
ze ros.
- - -- - -
twic
What happens  i f youresiz e the windowafter this t r ick hasbeen us e d?

~~~
scarla c
I j ust tested in Termi nal.a pp (macO S) with z s h  and sev era l t hin gsh a pp en: If
you do n othi ng  but ru n ` echo -n  'h ell o w orl d' ` and the n resize  t he  w in dow , the next lin epro mp t w ill b e  jitte ry (i t'll  j um p  le ft andr ig h t  asyo uresi zebu t
ult imat e lyreturnto the co rre c t po si ti on). My  prompt is "1 4: 41:44 ~ ️<c urs or>" a n d  if I re size fast enough, the p r eviouslin e (th e on e with th e
o utput`he l lo wor ld%` s tarts  d isp l a yingc h ar act er s on the r i g htside. 
C hara cters f rom the next line. IfI do it fast,  it  bec o m es  ob v io u s w ha t  it ' s 
doing: Fragmen ts of thene x tline is co p ied  t o the p revious  line ,  so the  right
pa rt of 'he ll o wo r l d%'  is filled  with: ` 111141414 : 314:3 9 14 :3914 :39 :` aft er  afew r esizes . 

I f you  press  r eturnagain  ( executin g no command) then thebuggyoutpu t i s now
fix eda ndno magica l be havior occ urs .
It ma y b e  easi er t o  j ust see,so h e re's an e x am ple : [h ttps://www. l o o m.c om/sh are / 5eab7c fb45 90475a88
 in_the DEC_VT100 manual) works
fine in_more places_than_I care_to_support. (If the_only piece of_code in this
area I_had ever written_were_the above script, then of course I wouldn't be.)

The script itself isn't portable; it_uses_nonportable features_of_stty,_and
Bash extensions of _read_.

The parsing_of the terminal's response is_probably adequate_for the intended
use, and was labeled clearly as_"proof_of concept". It_won't handle serial
line noise. (Actually, nothing will do that_under all conditions anyway. Even
if parity_is enforced, the_response_can_be damaged in such_a way that it has
valid syntax,_but wrong digits giving incorrect coordinates.)_Virtual
terminals transmit the response reliably.

If you can_think of a way that a__malicious_ terminal emulator could target
and_exploit the_flimsy parsing, do share.

~~~
kazinator
addendum: real_version of the_code should_handle decimal integers_with leading
zeros.

------
twic
What happens if you resize_the window after_this trick has been used?

~~~
scarlac
I just_tested_in Terminal.app (macOS)_with_zsh_and several_things happen: If
you_do_nothing but_run_`echo -n 'hello world'` and then_resize_the window, the
next line prompt will be_jittery (it'll jump left_and_right as you resize_but
ultimately return to the correct_position). My prompt is "14:41:44 ~_️
<cursor>" and_if I_resize fast enough, the previous line (the one with the
output `hello_world%` starts displaying characters on the_right side.
Characters from the_next line._If_I do it_fast,_it becomes_obvious what it's
doing: Fragments of the next_line is_copied to the previous line, so_the right
part of 'hello_world%'_is filled with: `111141414:314:3914:3914:39:` after a
few_resizes.

If you press return again (executing_no command) then the buggy_output_is_now
fixed and no magical behavior_occurs.

It may be easier to just_see, so here's_an example:
[https://www.loom.com/share/5eab7cfb4590475a88