Skip to content

Commit 1e66c11

Browse files
simarkeepp
authored andcommitted
Fix: lib: use appropriate format specifier to print message iterator class
Running babeltrace2 --debug /some/trace ... results in the following crash: ==31705==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f5b9c25ae22 bp 0x7ffc64114490 sp 0x7ffc64113ba8 T0) ==31705==The signal is caused by a READ memory access. ==31705==Hint: address points to the zero page. #0 0x7f5b9c25ae21 (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xfce21) #1 0x7f5b9c1d231f (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x7431f) #2 0x7f5b9c1fef4d in __interceptor_vsnprintf (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xa0f4d) #3 0x7f5b9c1ff286 in snprintf (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xa1286) #4 0x7f5b9bdf61c3 in format_component_class /home/smarchi/src/babeltrace/src/lib/lib-logging.c:1061 #5 0x7f5b9bdfad46 in handle_conversion_specifier_bt /home/smarchi/src/babeltrace/src/lib/lib-logging.c:1451 #6 0x7f5b9bead260 in bt_common_custom_vsnprintf /home/smarchi/src/babeltrace/src/common/common.c:1727 #7 0x7f5b9bdfb10b in bt_lib_log /home/smarchi/src/babeltrace/src/lib/lib-logging.c:1496 #8 0x7f5b9be32965 in bt_message_iterator_class_set_seek_beginning_methods /home/smarchi/src/babeltrace/src/lib/graph/message-iterator-class.c:138 ... This is due to an object being printed with the wrong format specifier. `C` is for component class objects, use `I` instead, since we are printing a message iterator object. Change-Id: Ie3985d8b7c4e02ac7d09aee84bfe46ea4bab87e9 Signed-off-by: Simon Marchi <[email protected]> Reviewed-on: https://review.lttng.org/c/babeltrace/+/3367 CI-Build: Philippe Proulx <[email protected]> Tested-by: jenkins <[email protected]> Reviewed-by: Philippe Proulx <[email protected]>
1 parent 5ca921c commit 1e66c11

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib/graph/message-iterator-class.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,6 @@ bt_message_iterator_class_set_seek_beginning_methods(
152152
message_iterator_class->methods.seek_beginning = seek_method;
153153
message_iterator_class->methods.can_seek_beginning = can_seek_method;
154154
BT_LIB_LOGD("Set message iterator class's \"seek beginning\" methods"
155-
": %!+C", message_iterator_class);
155+
": %!+I", message_iterator_class);
156156
return BT_FUNC_STATUS_OK;
157157
}

0 commit comments

Comments
 (0)