From 0ccdc6d37d8c1b86f686c121a5b98c2beadec0ca Mon Sep 17 00:00:00 2001 From: t123yh Date: Sat, 26 Aug 2017 20:59:18 +0800 Subject: [PATCH] Fix NaN detection. --- src/daemon/judge/judger-base.ts | 2 +- src/runner/judge.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/daemon/judge/judger-base.ts b/src/daemon/judge/judger-base.ts index 1f6c25b..ec94bde 100644 --- a/src/daemon/judge/judger-base.ts +++ b/src/daemon/judge/judger-base.ts @@ -71,7 +71,7 @@ export abstract class JudgerBase { currentTaskResult.errorMessage = err.toString(); winston.warn(`Task runner error: ${err.toString()} (subtask ${subtaskIndex}, case ${index})`); } - if (score === 0 || score === NaN) { + if (score == null || isNaN(score) || score === 0) { winston.debug(`Subtask ${subtaskIndex}, case ${index}: zero, skipping the rest.`); skipped = true; } diff --git a/src/runner/judge.ts b/src/runner/judge.ts index 1c2d954..ca2b31c 100644 --- a/src/runner/judge.ts +++ b/src/runner/judge.ts @@ -46,7 +46,7 @@ async function runSpj(spjBinDir: string, spjLanguage: Language): Promise spjFullScore) { + if ((!scoreString) || isNaN(score) || score < 0 || score > spjFullScore) { return { status: TestcaseResultType.JudgementFailed, message: `Special Judge returned an unrecoginzed score: ${scoreString}.`,