Hi,
I have a couple of null-pointer exceptions on a very simple example when running realizability checking (Kind2) and diagnosing them (JKind).
I'm using
Mac OS 15.4.1
JKind 4.5.1-202311081135
Detected solvers: smtinterpol, z
kind2 v2.3.0
NuSMV 2.6.0
If I select Kind2, I have a NPE when checking realizability
If I select JKind, I can check realizability (and it correctly detects one problem), but I get a NPE when diagnosing it.
The diff below fixes diagnosability when using JKind. For Kind2, the diff avoids the NPE but it cannot run.
Let me know if you need anything else, and thanks :-)!
diff --git a/fret-electron/analysis/realizabilityCheck.js b/fret-electron/analysis/realizabilityCheck.js
index eb7d29b..027dda9 100644
--- a/fret-electron/analysis/realizabilityCheck.js
+++ b/fret-electron/analysis/realizabilityCheck.js
@@ -34,7 +34,9 @@ export function checkRealizability(filePath, engine, options, callback) {
if (engine === 'kind2') {
var kind2Output = JSON.parse(stdout);
var logResults = kind2Output.filter(e => ((e.objectType === "log") && (e.level === "error")))[0];
- err.message = err.message + '\n' + logResults.value.toString();
+ if (logResults && ('value' in logResults) ) {
+ err.message = err.message + '\n' + logResults.value.toString();
+ }
}
var errorMessage = 'Error: ' + (engine === 'jkind' ? 'JKind' : 'Kind 2') + ' call terminated unexpectedly.'
callback(errorMessage);
@@ -43,11 +45,16 @@ export function checkRealizability(filePath, engine, options, callback) {
if (engine === 'jkind') {
result = stdout.match(new RegExp('(?:\\+\\n)' + '(.*?)' + '(?:\\s\\|\\|\\s(K|R|S|T))'))[1];
time = stdout.match(new RegExp('(Time = )(.*?)\\n'))[2];
-
+
if (options.includes('json')) {
var fileContent = fs.readFileSync(filePath+'.json', 'utf8');
jsonOutput = JSON.parse(fileContent);
- if (result === "REALIZABLE") {
+ if (result === "REALIZABLE"
+ && jsonOutput
+ && ('Counterexample' in jsonOutput)
+ && Array.isArray(jsonOutput.Counterexample)
+ && Array.isArray(jsonOutput.Counterexample[0])
+ && jsonOutput.Counterexample[0].length >1 ) {
realizableTraceInfo = {K: Object.keys(jsonOutput.Counterexample[0]).length - 2, Trace: jsonOutput.Counterexample};
} else {
realizableTraceInfo = null;
Hi,
I have a couple of null-pointer exceptions on a very simple example when running realizability checking (Kind2) and diagnosing them (JKind).
I'm using
Mac OS 15.4.1
JKind 4.5.1-202311081135
Detected solvers: smtinterpol, z
kind2 v2.3.0
NuSMV 2.6.0
If I select Kind2, I have a NPE when checking realizability
If I select JKind, I can check realizability (and it correctly detects one problem), but I get a NPE when diagnosing it.
The diff below fixes diagnosability when using JKind. For Kind2, the diff avoids the NPE but it cannot run.
Let me know if you need anything else, and thanks :-)!