- Definition lenDef = definitionScope.lookupDefinition(declaration.getLengthName());
- lengthDefinition = (IntegerDefinition) lenDef;
+ lenDef = definitionScope.lookupDefinition(declaration
+ .getLengthName());
+ }
+
+ if (lenDef == null) {
+ throw new CTFReaderException("Sequence length field not found"); //$NON-NLS-1$
+ }
+
+ if (!(lenDef instanceof IntegerDefinition)) {
+ throw new CTFReaderException("Sequence length field not integer"); //$NON-NLS-1$
+ }
+
+ lengthDefinition = (IntegerDefinition) lenDef;
+
+ if (this.lengthDefinition.getDeclaration().isSigned()) {
+ throw new CTFReaderException("Sequence length must not be signed"); //$NON-NLS-1$