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)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:39 +0000 (18:19 -0400)
commitc16748c703b0786c5daf4eda3a8af1da8bdf9cd8
treebe9025e0a367632b9b10d6e3940bf3c65ccdd336
parentdf59c3267afeaa9a56ad745dca3463ea3d3f690f
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.02467 seconds and 4 git commands to generate.