This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/1414 show bug in logging: erratic redirection to DLGLOBAL for invalid categories Add a check to logging_test.c to show a bug: when a logging category value that is out-of-bounds is passed to the logging system, the internal map_subsys() function should remap that to DLGLOBAL. But in fact DLGLOBAL is -1 and the function fails to map this to a proper positive array index, directly returning -1 instead. This results in a negative array index and undefined behavior. A sanitize build should catch this. The bug is confirmed by the fact that logging_test.err stays the same (hopefully) although a logging output should appear from this patch. The test could as well segfault or anything else, it's a bit of a gamble. This bug will be fixed along with the expectation in a subsequent patch. Note: osmo_log_info->num_cat + 0 is also out-of-bounds, but there is a separate bug there, so leaving this for another patch. Change-Id: I161b6550fa204a872bad1abefee1a6155393fafd --- M tests/logging/logging_test.c 1 file changed, 8 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/14/1414/1 diff --git a/tests/logging/logging_test.c b/tests/logging/logging_test.c index 91b0aaf..6c5a8f2 100644 --- a/tests/logging/logging_test.c +++ b/tests/logging/logging_test.c @@ -66,6 +66,8 @@ .filter_fn = test_filter, }; +extern struct log_info *osmo_log_info; + int main(int argc, char **argv) { struct log_target *stderr_target; @@ -108,5 +110,11 @@ select_output = 1; DEBUGP(DRLL, "You should see this\n"); OSMO_ASSERT(filter_called == 5); /* called twice on output */ + + /* Make sure out-of-bounds category maps to DLGLOBAL */ + log_parse_category_mask(stderr_target, "DLGLOBAL,1"); + DEBUGP(osmo_log_info->num_cat + 1, "You should see this on DLGLOBAL (a)\n"); + DEBUGP(osmo_log_info->num_cat + 100, "You should see this on DLGLOBAL (b)\n"); + return 0; } -- To view, visit https://gerrit.osmocom.org/1414 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I161b6550fa204a872bad1abefee1a6155393fafd Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>