Fix: bfcr_get_sequence_length_cb(): do not set text array's length
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 23 Apr 2019 23:54:42 +0000 (19:54 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 May 2019 04:09:19 +0000 (00:09 -0400)
commit2187c251b5e7458f57a6df9a4c1741296bb7dd35
treedd05d675a6a6b91c6b54600df6e3da6c01b79fe3
parent43a1945a719329906b7e70ca36894e2f15f90bdb
Fix: bfcr_get_sequence_length_cb(): do not set text array's length

Issue
=====
In `msg-iter.c`, bfcr_get_sequence_length_cb() gets called when starting
the decoding of any sequence, including text sequences. However, text
arrays are translated into trace IR string field classes.

bfcr_get_sequence_length_cb() calls bt_field_dynamic_array_set_length()
unconditionally, but its field argument can be a string field at this
point. This is a precondition break.

Solution
========
In bt_field_dynamic_array_set_length(), only call
bt_field_dynamic_array_set_length() if the CTF IR field class is NOT a
text sequence. I'm also adding an assertion to confirm that the trace IR
field is a dynamic array field.

Known drawbacks
===============
None.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
plugins/ctf/common/msg-iter/msg-iter.c
This page took 0.023649 seconds and 5 git commands to generate.