Skip to content

over-indexing length constrained array is allowed by TITAN

Summary

A two-dimensional array is created with the length restriction of 10 in both directions. However, setting its 11th (i.e. 12th) element is allowed by TITAN.

Steps and/or TTCN-3 code to reproduce

Create a module with the following content:

type record length (10) of record length (10) of integer Matrix;

testcase nested_def() runs on ct_empty{
  var Matrix w;
  w[11][11] := 2;
  log(w);
  setverdict(pass);
}

What is the current bug behavior?

The code builds and runs

What is the expected correct behavior?

Error (probably compilation time).

Relevant logs and/or screenshots

This is the value of w at the end of the testcase:

MTC@HUL21014: { <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, { <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, <unbound>, 2 } }

Possible fixes

Titan version

8.1.0

Platform details (OS type and version)

Microsoft Windows 10 Enterprise 10.0.19042

/cc @aknappqwt