Skip to content

Commit 9bd0937

Browse files
committed
ctf: remove sequence bit length calculation as it cannot be known
Signed-off-by: Arnaud Fiorini <fiorini.arnaud@gmail.com>
1 parent dc7aa47 commit 9bd0937

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types

ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/types/SequenceDeclaration.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,15 @@ public AbstractArrayDefinition createDefinition(
116116
}
117117

118118
long length = lengthDefinition.getValue();
119-
long maxBits = length * fElemType.getMaximumSize();
120-
if ((length > Integer.MAX_VALUE) || (maxBits > Integer.MAX_VALUE) || (!input.canRead((int) maxBits))) {
119+
if (length > Integer.MAX_VALUE ) {
121120
throw new CTFException("Sequence length too long " + length); //$NON-NLS-1$
122121
}
123-
122+
if (fElemType.getMaximumSize() != Integer.MAX_VALUE) {
123+
long maxBits = length * fElemType.getMaximumSize();
124+
if (maxBits > Integer.MAX_VALUE || !input.canRead((int) maxBits)) {
125+
throw new CTFException("Sequence length too long " + length); //$NON-NLS-1$
126+
}
127+
}
124128
// Explicitly align to support 0-length sequences
125129
alignRead(input);
126130

0 commit comments

Comments
 (0)