From 1e34d3c84d499dad12ee6ade80eda7514142b5c9 Mon Sep 17 00:00:00 2001 From: Jérémie Galarneau Date: Wed, 16 Oct 2013 16:51:55 -0400 Subject: Fix Float reading in CTF traces Ensure that the BitBuffer's potision is aligned properly with respect to the FloatDeclaration's alignment constraints before reading the value. Reference bug #419536 Change-Id: Ia0e5aadb7baa7899cbddaded1bfe593ea734e89c Signed-off-by: Jérémie Galarneau Reviewed-on: https://git.eclipse.org/r/17432 Reviewed-by: Matthew Khouzam IP-Clean: Matthew Khouzam Tested-by: Matthew Khouzam Reviewed-by: Alexandre Montplaisir --- .../org/eclipse/linuxtools/ctf/core/event/types/FloatDefinition.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/FloatDefinition.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/FloatDefinition.java index 4b0153d7f8..14a8b2ada8 100644 --- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/FloatDefinition.java +++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/FloatDefinition.java @@ -88,6 +88,9 @@ public class FloatDefinition extends Definition { public void read(BitBuffer input) { int exp = declaration.getExponent(); int mant = declaration.getMantissa(); + int align = (int) declaration.getAlignment(); + int pos = input.position() + ((align - (input.position() % align)) % align); + input.position(pos); if ((exp + mant) == 32) { value = readRawFloat32(input, mant, exp); } else if ((exp + mant) == 64) { -- cgit v1.2.3