ctf: avoid using computing offset from nullptr pointer
authorSimon Marchi <simon.marchi@efficios.com>
Sat, 18 Feb 2023 02:17:15 +0000 (21:17 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 7 Mar 2023 16:23:40 +0000 (11:23 -0500)
commite458ac29e6e221e35996f1f615e07a8fad4c7d27
tree7667beb7b7e4a47b5c24cefd0fb13609594fb8fc
parentd6185733d12572f9227fcb9fe5be8b82bd43ee45
ctf: avoid using computing offset from nullptr pointer

When running the test_trace_collection_message_iterator.py test in a
build with -fsanitize=undefined, I see:

  /home/simark/src/babeltrace/src/plugins/ctf/common/metadata/visitor-generate-ir.cpp:1143:30: runtime error: member access within null pointer of type 'struct ctf_node'

This happens when `node_field_class_declarator` is nullptr.  Avoid this
by using `node_field_class_declarator` once we know it's non-nullptr.

Change-Id: I585e5b17af7e1a16a217ef46c0a49fae901dcae8
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/9513
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/plugins/ctf/common/metadata/visitor-generate-ir.cpp
This page took 0.024196 seconds and 4 git commands to generate.