From 3a0f64545ecc4dfeaa4c48f8eba23df65f6f434c Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 23 Mar 2022 14:01:56 -0400 Subject: [PATCH] throw for invalid row or col --- addons/xterm-addon-search/src/SearchAddon.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/xterm-addon-search/src/SearchAddon.ts b/addons/xterm-addon-search/src/SearchAddon.ts index 0e0fcef1..0f677072 100644 --- a/addons/xterm-addon-search/src/SearchAddon.ts +++ b/addons/xterm-addon-search/src/SearchAddon.ts @@ -168,6 +168,10 @@ export class SearchAddon implements ITerminalAddon { this.clearDecorations(); return undefined; } + if (startRow > this._terminal.rows || startCol > this._terminal.cols) { + throw new Error(`Invalid row: ${startRow} or col: ${startCol} to search in terminal with ${this._terminal.rows} rows and ${this._terminal.cols} cols`); + } + let result: ISearchResult | undefined = undefined; this._initLinesCache();