Commit 5cf30041 authored by Nadim Kobeissi's avatar Nadim Kobeissi 💾
Browse files

Additional bug fix for primitive rewrite logic

parent 92b56dcf
Pipeline #711 failed with stages
in 20 seconds
......@@ -16,7 +16,7 @@ type VerifpalTest struct {
ResultsCode string
}
var verifpalTests = []VerifpalTest{
var verifpalTests = [54]VerifpalTest{
{
Model: "challengeresponse.vp",
ResultsCode: "a0a1",
......
......@@ -230,17 +230,21 @@ func valuePerformPrimitiveRewrite(
rIndex = p.Output
}
if rIndex >= len(rewrittenValues) {
valPrincipalState.Assigned[pi] = valueNil
if !valPrincipalState.Mutated[pi] {
valPrincipalState.BeforeMutate[pi] = valueNil
if pi >= 0 {
valPrincipalState.Assigned[pi] = valueNil
if !valPrincipalState.Mutated[pi] {
valPrincipalState.BeforeMutate[pi] = valueNil
}
}
return failedRewrites, (rewritten || rewrittenRoot), valueNil
}
if (rewritten || rewrittenRoot) && pi >= 0 {
valPrincipalState.Rewritten[pi] = true
valPrincipalState.Assigned[pi] = rewrittenValues[rIndex]
if !valPrincipalState.Mutated[pi] {
valPrincipalState.BeforeMutate[pi] = rewrittenValues[rIndex]
if rewritten || rewrittenRoot {
if pi >= 0 {
valPrincipalState.Rewritten[pi] = true
valPrincipalState.Assigned[pi] = rewrittenValues[rIndex]
if !valPrincipalState.Mutated[pi] {
valPrincipalState.BeforeMutate[pi] = rewrittenValues[rIndex]
}
}
}
return failedRewrites, (rewritten || rewrittenRoot), rewrittenValues[rIndex]
......
......@@ -11,11 +11,12 @@ require (
github.com/josephspurrier/goversioninfo v1.2.0 // indirect
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/mna/pigeon v1.0.0 // indirect
github.com/spf13/cobra v1.1.0
github.com/spf13/cobra v1.1.1
github.com/spf13/pflag v1.0.5 // indirect
github.com/ugorji/go v1.1.4 // indirect
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77 // indirect
golang.org/dl v0.0.0-20200414231856-f86334ee252a // indirect
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
golang.org/x/sys v0.0.0-20201008064518-c1f3e3309c71 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
)
......@@ -165,6 +165,8 @@ github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8=
github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE=
github.com/spf13/cobra v1.1.0 h1:aq3wCKjTPmzcNWLVGnsFVN4rflK7Uzn10F8/aw8MhdQ=
github.com/spf13/cobra v1.1.0/go.mod h1:yk5b0mALVusDL5fMM6Rd1wgnoO5jUPhwsQ6LQAJTidQ=
github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4=
github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
......@@ -309,6 +311,7 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment