summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorEtienne Bergeron2013-11-30 00:16:54 (EST)
committer Matthew Khouzam2013-12-02 18:14:03 (EST)
commitbaefea225705e7ea34fe63d2b1cddb9a5870bf99 (patch)
tree133bf282eb1c1fc06b9fbbe5b4a65e6655eb5b75
parent963272d9994c73f36706253363b5f1f0b4016fa4 (diff)
downloadorg.eclipse.linuxtools-baefea225705e7ea34fe63d2b1cddb9a5870bf99.zip
org.eclipse.linuxtools-baefea225705e7ea34fe63d2b1cddb9a5870bf99.tar.gz
org.eclipse.linuxtools-baefea225705e7ea34fe63d2b1cddb9a5870bf99.tar.bz2
ctf: Fix decoding of an invalid packet id type.refs/changes/66/19166/3
When an event id is not present, it is assumed to be zero. Otherwise, it must be a _valid_ integer. The current implementation accepts a "struct" as an id and map to the event id zero. This fix throw an exception on an invalid id. Change-Id: Iff6f6bd0173048dd3fb9b00f564948d7ebd55f4f Signed-off-by: Etienne Bergeron <etienne.bergeron@gmail.com> Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Reviewed-on: https://git.eclipse.org/r/19166 IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Hudson CI
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketReader.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketReader.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketReader.java
index 58b8332..257cedf 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketReader.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketReader.java
@@ -327,7 +327,9 @@ public class StreamInputPacketReader implements IDefinitionScope {
Definition idDef = sehd.lookupDefinition("id"); //$NON-NLS-1$
if (idDef instanceof SimpleDatatypeDefinition) {
eventID = ((SimpleDatatypeDefinition) idDef).getIntegerValue();
- } // else, eventID remains 0
+ } else if (idDef != null) {
+ throw new CTFReaderException("Incorrect event id : " + eventID);
+ }
/*
* Get the timestamp from the event header (may be overridden later