[PR #14515] [MERGED] Added null check before rendering a string from the terminal connection #30126

Open
opened 2026-01-31 09:38:47 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/14515
Author: @javierdlg
Created: 12/8/2022
Status: Merged
Merged: 12/9/2022
Merged by: @undefined

Base: mainHead: dev/jadelaga/PreventNullStringWrite


📝 Commits (1)

  • 0e9e58b Added null check before rendering a string from the terminal connection

📊 Changes

1 file changed (+2 additions, -1 deletions)

View changed files

📝 src/cascadia/WpfTerminalControl/TerminalContainer.cs (+2 -1)

📄 Description

Summary of the Pull Request

Watson reports show that Visual Studio terminal attempts to render a string that is null causing the renderer to crash.

More specifically, we see "NULL_POINTER_WRITE_c0000005_PublicTerminalCore.dll!TextBuffer::WriteLine" with the following stack:
PublicTerminalCore!TextBuffer::WriteLine+0x1da
PublicTerminalCore!TextBuffer::Write+0x191
PublicTerminalCore!Microsoft::Terminal::Core::Terminal::_WriteBuffer+0x1d3
PublicTerminalCore!Microsoft::Terminal::Core::Terminal::PrintString+0x9
PublicTerminalCore!TerminalDispatch::PrintString+0x22
PublicTerminalCore!Microsoft::Console::VirtualTerminal::OutputStateMachineEngine::ActionPrintString+0x42
PublicTerminalCore!Microsoft::Console::VirtualTerminal::StateMachine::ProcessString+0x123
PublicTerminalCore!TerminalSendOutput+0x68
Microsoft_DotNet_MSBuildSdkResolver!DomainBoundILStubClass.IL_STUB_PInvoke(IntPtr, System.String)+0x8f
Microsoft_Terminal_Wpf!Microsoft.Terminal.Wpf.TerminalContainer.Connection_TerminalOutput(System.Object, Microsoft.Terminal.Wpf.TerminalOutputEventArgs)+0x20
Microsoft_VisualStudio_Terminal_Implementation!Microsoft.VisualStudio.Terminal.TerminalWindowBase+<>c__DisplayClass59_0+<b__0>d.MoveNext()+0x55f

References

Internal bug: Bug 1614709: [Watson] crash64: NULL_POINTER_WRITE_c0000005_PublicTerminalCore.dll!TextBuffer::WriteLine

Detailed Description of the Pull Request / Additional comments

Added a null check before PInvoking TerminalSendOutput.

Validation Steps Performed

Validated locally that the check prevents null strings from rendering.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/14515 **Author:** [@javierdlg](https://github.com/javierdlg) **Created:** 12/8/2022 **Status:** ✅ Merged **Merged:** 12/9/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/jadelaga/PreventNullStringWrite` --- ### 📝 Commits (1) - [`0e9e58b`](https://github.com/microsoft/terminal/commit/0e9e58bc00daebb282d00b2ba77a1cd5b60b407f) Added null check before rendering a string from the terminal connection ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/WpfTerminalControl/TerminalContainer.cs` (+2 -1) </details> ### 📄 Description ## Summary of the Pull Request Watson reports show that Visual Studio terminal attempts to render a string that is null causing the renderer to crash. More specifically, we see "NULL_POINTER_WRITE_c0000005_PublicTerminalCore.dll!TextBuffer::WriteLine" with the following stack: PublicTerminalCore!TextBuffer::WriteLine+0x1da PublicTerminalCore!TextBuffer::Write+0x191 PublicTerminalCore!Microsoft::Terminal::Core::Terminal::_WriteBuffer+0x1d3 PublicTerminalCore!Microsoft::Terminal::Core::Terminal::PrintString+0x9 PublicTerminalCore!TerminalDispatch::PrintString+0x22 PublicTerminalCore!Microsoft::Console::VirtualTerminal::OutputStateMachineEngine::ActionPrintString+0x42 PublicTerminalCore!Microsoft::Console::VirtualTerminal::StateMachine::ProcessString+0x123 PublicTerminalCore!TerminalSendOutput+0x68 Microsoft_DotNet_MSBuildSdkResolver!DomainBoundILStubClass.IL_STUB_PInvoke(IntPtr, System.String)+0x8f Microsoft_Terminal_Wpf!Microsoft.Terminal.Wpf.TerminalContainer.Connection_TerminalOutput(System.Object, Microsoft.Terminal.Wpf.TerminalOutputEventArgs)+0x20 Microsoft_VisualStudio_Terminal_Implementation!Microsoft.VisualStudio.Terminal.TerminalWindowBase+<>c__DisplayClass59_0+<<BeginProcessingPtyData>b__0>d.MoveNext()+0x55f ## References Internal bug: [Bug 1614709](https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1614709): [Watson] crash64: NULL_POINTER_WRITE_c0000005_PublicTerminalCore.dll!TextBuffer::WriteLine ## Detailed Description of the Pull Request / Additional comments Added a null check before PInvoking TerminalSendOutput. ## Validation Steps Performed Validated locally that the check prevents null strings from rendering. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:38:47 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30126