[js/web] check session ID in releaseSession() (#9105)

This commit is contained in:
Yulong Wang 2021-09-20 17:49:53 -07:00 committed by GitHub
parent 5e197698b8
commit 750e2e0481
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,7 +84,7 @@ export const createSession =
export const releaseSession = (sessionId: number): void => {
const wasm = getInstance();
const session = activeSessions[sessionId];
if (!session) {
if (!Number.isSafeInteger(sessionId) || !session) {
throw new Error('invalid session id');
}
const sessionHandle = session[0];