From: Philippe Proulx Date: Tue, 23 Apr 2019 23:54:42 +0000 (-0400) Subject: Fix: bfcr_get_sequence_length_cb(): do not set text array's length X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=2187c251b5e7458f57a6df9a4c1741296bb7dd35;hp=2187c251b5e7458f57a6df9a4c1741296bb7dd35;p=deliverable%2Fbabeltrace.git 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 ---