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)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
commit785a6bba2ea1a9d808fefefa1954912a2005fbc1
treedd05d675a6a6b91c6b54600df6e3da6c01b79fe3
parent5dcc1b0b05f86297cbc58d44b7fadb971d842d78
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.025419 seconds and 4 git commands to generate.