-
-
Notifications
You must be signed in to change notification settings - Fork 131
Description
Bug description
Currently, log_structured!
passes GLIB_DOMAIN
as a log field with byte value and explicit length. However, GLib expects GLIB_DOMAIN
to be a nul-terminated C string, see should_drop_message
which calls domain_found
which in turn uses strlen
on the domain value.
This breaks debug logging for Rust domains via $G_MESSAGES_DEBUG
, because GLib fails to find the domain in the environment variable, see #1534
I'm only superficially familiar with C, and haven't checked the entire call stack, but it also seems that passing GLIB_DOMAIN
as field with explicit length, i.e. omitting the final NUL byte from the field value, probably even leads to out-of-bounds memory access in GLib 🤔
I'm not sure whether this constitutes an issue in GLib, but it can be fixed on the Rust side by passing the domain as nul-terminated string, at the cost of one allocation. I'll make a pull request.