Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

System.ArgumentOutOfRangeException #863

Closed
YexuanXiao opened this issue Feb 26, 2019 · 7 comments
Closed

System.ArgumentOutOfRangeException #863

YexuanXiao opened this issue Feb 26, 2019 · 7 comments
Labels
OutOfRange Issues relating to System.ArgumentOutOfRangeException

Comments

@YexuanXiao
Copy link

PS version: 5.1.18305.1000
PSReadline version: 2.0.0-beta2
os: 10.0.18345.1000 (WinBuild.160101.0800)
PS file version: 10.0.18345.1000 (WinBuild.160101.0800)

Steps to reproduce or exception report:
create a folder structure like:
E:\BaiduNetdiskDownload[流派未確定]\2009.08.15 [RMCD-0001] 東方幻響曲 [C76]\2009.08.15 [RMCD-0001] 東方幻響曲 [C76]
run powershell in the deepest folder and input a char

PS E:\BaiduNetdiskDownload[流派未確定]\2009.08.15 [RMCD-0001] 東方幻響曲 [C76]\2009.08.15 [RMCD-0001] 東方幻響曲 [C76]>
哎呀,出现问题。请在报告此 Bug 时添加以下详细信息。
在 GitHub 上报告: https://github.com/lzybkr/PSReadLine/issues/new

上 1 个密钥:
.

异常:
System.ArgumentOutOfRangeException: 该值必须大于或等于零,且必须小于控制台缓冲区在该维度的大小。
参数名: left
实际值是 -1。
在 System.Console.SetCursorPosition(Int32 left, Int32 top)
在 Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 value)
在 Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
在 Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
在 Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
在 Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable1 key, Object arg) 在 Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
在 Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
在 Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

PS E:\BaiduNetdiskDownload[流派未確定]\2009.08.15 [RMCD-0001] 東方幻響曲 [C76]\2009.08.15 [RMCD-0001] 東方幻響曲 [C76]>

@ptytb
Copy link

ptytb commented Mar 13, 2019

Similar thing happened to me, I've been pasting chunks of async IO code on terminal, and suddenly this.
I can post a whole sample if needed.


Last 200 Keys:

 i v e d ( $ E r r o r C a l l b a c k ) Enter
 Space Space Space Space Space Space Space Space $ p r o c e s s . a d d _ E x i t e d ( $ E r r o r C a l l b a c k ) Enter
 Enter
 Space Space Space Space Space Space Space Space $ p r o c e s s . S t a r t ( ) Enter
 Enter
 Space Space Space Space Space Space Space Space $ p r o c e s s . B e g i n O u t p u t R e a d L i n e ( ) Enter
 Space Space Space Space Space Space Space Space $ p r o c e s s . B e g i n E r r o r R e a d L i n e ( ) Enter
 Enter
 Space Space Space Space Space Space Space Space $ p r o c e s s . W a i t F o r E x i t ( )

Exception:

System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: left
Actual value was -2.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 value)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)

@aarontheadmin
Copy link

My experience of this is in PS 6.1.3 with PSReadLine 2.0.0. I paste a simple function from VS Code into Terminal and below is the result.

I had the same Terminal window used for copy over a PS remoting session and even ran clear before pasting from VS Code.

Also tried multiple keystrokes to exit to a prompt but that just repeated the error message for each stroke.

Name Value
PSVersion 6.1.3
PSEdition Core
GitCommitId 6.1.3
OS Darwin 18.2.0 Darwin Kernel Version 18.2.0: T...
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Last 200 Keys:

 o r Space - E x c e p t i o n Space " C o u l d Space n o t Space c l o s e Space $ a p p " Enter
 Space Space Space Space Space Space Space Space } Enter
 Space Space Space Space } Enter
 } Enter
 UpArrow LeftArrow LeftArrow LeftArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow DownArrow DownArrow DownArrow DownArrow RightArrow RightArrow RightArrow RightArrow RightArrow DownArrow RightArrow RightArrow RightArrow " t h i s Backspace Backspace Backspace Backspace Enter
 } Enter
 UpArrow DownArrow UpArrow DownArrow DownArrow Enter
 Enter
 } } } } } } } } } } } } } } } } } } } } } } } } } } } } Enter
 d \ e x i t Enter
 Enter
 e x i t Enter
 q Enter
 Enter
 Enter
 q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q

Exception:

System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -13.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)

@YuhaoTang
Copy link

Similar exception happened to me

上 2 个密钥:
` UpArrow

异常:
System.ArgumentOutOfRangeException: 该值必须大于或等于零,且必须小于控制台缓冲区在该维度的大小。
参数名: top
实际值是 -1。
在 System.Console.SetCursorPosition(Int32 left, Int32 top)
在 Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
在 Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
在 Microsoft.PowerShell.PSConsoleReadLine.HistoryRecall(Int32 direction)
在 Microsoft.PowerShell.PSConsoleReadLine.PreviousHistory(Nullable1 key, Object arg) 在 Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
在 Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
在 Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

PS version: 5.1.17763.316
PSReadline version: 2.0.0-beta2
os: 10.0.17763.346 (WinBuild.160101.0800)
PS file version: 10.0.17763.346 (WinBuild.160101.0800)

Steps to reproduce or exception report
After start PowerShell, I press Win+left to snap to left, and then press up to show last command

@robieerto
Copy link

I get same exception, after opening PS and pressing UpArrow key quickly.

@Gungor-x
Copy link

Gungor-x commented Aug 17, 2019


My PowerShell Version Info

PS version: 5.1.17763.592
PSReadline version: 2.0.0-beta2
os: 10.0.17763.1 (WinBuild.160101.0800)
PS file version: 10.0.17763.1 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 3000


Exception:
System.ArgumentOutOfRangeException: Değer sıfırdan büyük veya eşit olduğu ve bu boyuttaki konsolun ara bellek boyutundan küçük olmalıdır.
Parametre adı: top
Gerçek değer -7985 idi
konum: System.Console.SetCursorPosition(Int32 left, Int32 top)
konum: Microsoft.PowerShell.PSConsoleReadLine.ReallyRender (Render-Data, String defaultColor)
konum: Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
konum: Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
konum: Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable'1 key, object arg)
konum: Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary'2 dispatchTable, Boolean
gnoreIfNoAction, Object arg)
konum: Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
konum: Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

(Turkish)
Komut satırına tek seferde sınırsız karakter girişi yapılabiliyor.
Bu sebeple "Stack OverFlow" hatasını olup olmadığını kontrol ediyordum.
o anda "System.Console.SetCursorPosition(Int32 left, Int32 top)" fonksiyonunun "top" değişkeni alabileceği değerlerin dışında olduğu için hata verdi.
Büyük ihtimal bu hatanın dışında da belirtiğim sebepten (Tek seferde sınırsız karakter girişi yapılmasından dolayı) "Stack OverFlow" güvenlik açığı olması muhtemeldir.

(English)
Unlimited characters can be entered into the command line at one time.
So I was checking for the "Stack OverFlow" error.
At that time, the error "System.Console.SetCursorPosition (Int32 left, Int32 top)" is out of the range that the "top" variable can take.
It is also possible that there is a "Stack OverFlow" vulnerability due to the fact that unlimited characters can be entered into the command line at one time.
StackOverFlow

@Xrayez
Copy link

Xrayez commented Sep 8, 2019

PS version: 5.1.18362.145
PSReadline version: 2.0.0-beta2
os: 10.0.18362.1 (WinBuild.160101.0800)
PS file version: 10.0.18362.1 (WinBuild.160101.0800)
BufferWidth: 167
BufferHeight: 18

Last 33 Keys:
 g i t Space c o n f i g Space - - l i s t Space - - s h o w - o r i g i n Enter
 Ctrl+l

Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -6.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

@daxian-dbw
Copy link
Member

Fixed by #979 and #967

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
OutOfRange Issues relating to System.ArgumentOutOfRangeException
Projects
None yet
Development

No branches or pull requests

9 participants