Skip to content

The system detected an overrun of a stack-based buffer in this application  #7763

Closed

Description

@unavaliabl3

Environment

Windows build number:  19041.388
Windows Terminal version (if applicable): 1.3.2651.0

Steps to reproduce

  • on Windows PowerShell execute cat <a big file: lager than 2MB>, using vim to edit the big file, list files in the directory, use any terminal program to deal with big files will cause error The system detected an overrun of a stack-based buffer in this application

  • on WSL execute htop,top,cat <a big file>, using any programs to process file larger than 2MB, use resources intensive programs such as MySQL server will cause error The system detected an overrun of a stack-based buffer in this application

  • on cmd, PowerShell core, git bash, etc. is the same

the error only occurs when running shell on Windows Terminal , not the programs them self.

screenshots

image
image
image
image
image
image

PS

The shell and programs are still running after Windows Terminal crashed.

Activity

  1. ghost added
    Needs-Triage
    on Sep 28, 2020
  2. ghost added
    Needs-Tag-Fix
    on Sep 28, 2020
  3. KalleOlaviNiemitalo commented on Sep 28, 2020

    @KalleOlaviNiemitalo

    I hit something similar on 2020-09-25. Windows Terminal Preview 1.4.2652.0 on Windows 10 build 19041.508 crashed several times with exception code 0xc0000409 (STATUS_STACK_BUFFER_OVERRUN) when I was trying to use "git log". There were no message boxes but the reliability history and the Application event log show this code. I have not been able to reproduce the error later.

  4. unavaliabl3 commented on Sep 29, 2020

    @unavaliabl3
    Author

    The error could temporarily disappear after reboot the computer or logout and login, however, after a period of time, I can still reproduce the error. From Windows Terminal beta to 1.3.2651.0, this is the first time I get those errors. Windows Terminal Preview 1.4.2652.0 crashes on my computer too.

  5. DHowett commented on Sep 29, 2020

    @DHowett
    Member

    I can't reproduce this. Can one of you use task manager to capture a dump file of Terminal when that dialog pops up?

  6. added
    Needs-Author-Feedback
    on Sep 29, 2020
  7. unavaliabl3 commented on Sep 30, 2020

    @unavaliabl3
    Author
  8. ghost added
    Needs-Attention
    on Sep 30, 2020
  9. ghost removed
    Needs-Author-Feedback
    on Sep 30, 2020
  10. KalleOlaviNiemitalo commented on Sep 30, 2020

    @KalleOlaviNiemitalo

    @rekaerst's dump file has Windows_UI_Xaml!CXamlIslandRoot::OnIslandPointerWheelChanged + 0x12 in the call stack of the thread that called KERNELBASE!RaiseFailFastException. I am pretty sure I was not using the mouse wheel when Windows Terminal Preview crashed. But if the bug is in rendering, then it could crash in both situations anyway.

  11. unavaliabl3 commented on Sep 30, 2020

    @unavaliabl3
    Author

    I was not using a mouse when it crashed too. I was just running cat some_text_file command.

  12. KalleOlaviNiemitalo commented on Sep 30, 2020

    @KalleOlaviNiemitalo

    Apparently, WilFailFast uses STATUS_STACK_BUFFER_OVERRUN even if the error is not a buffer overrun. The instructions immediately before the return address TerminalControl!DllGetActivationFactory+0x27a3c set R8 = "E:\BA\127\s\src\buffer\out\textBuffer.cpp" and EDX = 280, so I think it blew up in TextBuffer::_PrepareForDoubleByteSequence here:

    // Assert the buffer state is ready for this character
    // This function corrects most errors. If this is false, we had an uncorrectable one.
    FAIL_FAST_IF(!(_AssertValidDoubleByteSequence(dbcsAttribute))); // Shouldn't be uncorrectable sequences unless something is very wrong.

  13. DHowett commented on Sep 30, 2020

    @DHowett
    Member

    So, this is interesting! This dump is the same as in #4907. We've tried to tackle this issue before, but not quite gotten there. It seems that there's some buffer corruption where a DBCS character gets split and the trailing half gets duplicated (by a function that isn't checking its legality), which then explodes when it hits this function (Reflow) that does check.

    We usually only see it during resize, which includes mouse wheel scrolling.

    Kalle Olavi Niemitalo (@KalleOlaviNiemitalo) I'll keep this open to see if you can produce a dump that's different?

    Symbols for 1.4.2652

  14. KalleOlaviNiemitalo commented on Sep 30, 2020

    @KalleOlaviNiemitalo

    OK, I added a Registry key as instructed in Collecting User-Mode Dumps, so that I'll get a dump if WindowsTerminal.exe crashes again.

  15. added
    Needs-Author-Feedback
    and removed
    Needs-Attention
    on Oct 1, 2020
  16. DHowett commented on Oct 1, 2020

    @DHowett
    Member

    Thanks!

  17. ghost added
    No-Recent-Activity
    on Oct 5, 2020
  18. ghost closed this as completedon Oct 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-Author-FeedbackNeeds-Tag-FixNeeds-TriageNo-Recent-Activity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions