Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Input memory exhaustion #2108

Closed
Tyriar opened this issue May 21, 2019 · 1 comment · Fixed by #2120
Closed

Input memory exhaustion #2108

Tyriar opened this issue May 21, 2019 · 1 comment · Fixed by #2120

Comments

@Tyriar
Copy link
Member

Tyriar commented May 21, 2019

Forked off from #2077

The time-based input limiting contains a buffer, that gets drained only once all chunks were handled.
This way fast producers can easily exhaust memory and will crash the terminal / browser engine.

Partial fix: Trim/slice already handled chunks from the buffer.

xterm.js/src/Terminal.ts

Lines 1441 to 1447 in af81acc

if (this.writeBuffer.length > bufferOffset) {
// Allow renderer to catch up before processing the next batch
setTimeout(() => this._innerWrite(bufferOffset), 0);
} else {
this._writeInProgress = false;
this.writeBuffer = [];
}

@Tyriar
Copy link
Member Author

Tyriar commented May 21, 2019

Trimming writeBuffer once bufferOffset reaches some threshold should be enough to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant