Skip to content

Commit fe965fe

Browse files
authored
Merge pull request #53 from handyscript/Fix-Prototype-polluting-assignment
avoid Prototype-Pollution assisgnment #37
2 parents 174187d + 1e7448e commit fe965fe

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎lib/matrix.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,9 @@ export default class Matrix {
200200
if (!Matrix.isValidIndex(this, row, col)) {
201201
throw new Error("Invalid row or column index.");
202202
}
203-
this.data[row][col] = value;
203+
// avoid Prototype-Pollution assisgnment
204+
this.data[row] = [...this.data[row].slice(0, col), value, ...this.data[row].slice(col + 1)];
205+
// this.data[row][col] = value;
204206
}
205207

206208
/**

0 commit comments

Comments
 (0)