Commit f9cdffcb authored by Maxime Perrotin's avatar Maxime Perrotin

Fix empty sequences when converting VN to CTypes

parent e756f8bf
......@@ -253,7 +253,7 @@ def valueNotationToCTypes(gser, dest, sort, ASN1Mod, ASN1_AST, var=None):
if sort.kind == 'ReferenceType':
sort = ASN1_AST[sort.ReferencedTypeName].type
if isinstance(inp, list):
# SEQUENCE OF
# SEQUENCE OF or EMPTY SEQUENCE (same syntax {})
# get the path to the sequence of
_, params, path = outp.GetState()
if path:
......@@ -264,12 +264,17 @@ def valueNotationToCTypes(gser, dest, sort, ASN1Mod, ASN1_AST, var=None):
reach(each, outp)
# Follow the ASN.1 type in the AST from ASN1SCC
rec(inp[i], outp[i], sort.type)
if sort.Min != sort.Max:
outp.Reset()
for each in path:
reach(each, outp)
# The ASN1SCC AST only knows if the list has a fixed length
outp.SetLength(len(inp))
try:
if sort.Min != sort.Max:
outp.Reset()
for each in path:
reach(each, outp)
# The ASN1SCC AST only knows if the list has a fixed length
outp.SetLength(len(inp))
except AttributeError:
# no Min/Max: it is not a SEQUENCE OF but an empty SEQUENCE
# No value to set, we can just return
pass
elif isinstance(inp, (int, float, bool)):
outp.Set(inp)
elif isinstance(inp, str):
......
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