Merge pull request #1076 from mattias-symphony/SDA-2465

fix: SDA-2465 Clamping the display id to ensure we are not accessing outside the array
This commit is contained in:
Johan Kwarnmark 2020-09-17 09:50:16 +02:00 committed by GitHub
commit ced1c6b3da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -803,10 +803,12 @@ export class WindowHandler {
this.execCmd(this.screenShareIndicatorFrameUtil, [ source.display_id ]);
} else {
const dispId = source.id.split(':')[1];
const clampedDispId = Math.min(dispId, displays.length - 1);
const keyId = 'id';
logger.info('window-utils: dispId: ' + dispId);
logger.info('window-utils: displays [' + dispId + '] [id]: ' + displays [dispId] [ keyId ]);
this.execCmd(this.screenShareIndicatorFrameUtil, [ displays [dispId] [ keyId ].toString() ]);
logger.info('window-utils: clampedDispId: ' + clampedDispId);
logger.info('window-utils: displays [' + clampedDispId + '] [id]: ' + displays [clampedDispId] [ keyId ]);
this.execCmd(this.screenShareIndicatorFrameUtil, [ displays [clampedDispId] [ keyId ].toString() ]);
}
}
}