mirror of https://gerrit.osmocom.org/libosmocore
show bug in logging: out-of-bounds check should end with user categories
In the background osmo_log_info array, the user's logging categories are enhanced by the library internal ones. So far logging category range checking only checked for the larger array bounds, although passing a logging category >= num_cat_user is already semantically unknown and should redirect to DLGLOBAL. Add a check to logging_test.c to show that this isn't happening. Instead of DLGLOBAL, a logging category that happens to be at that index is queried. The bug is confirmed by logging_test.err only showing "(e)" and not "(d)": "(e)" is shown because the first category after the user ones happens to be DLGLOBAL. "(d)" is omitted since it hits a category that's not on debug level. This bug will be fixed along with the expectation in a subsequent patch. Change-Id: I397278714018ee9a0ae5101515f31ddddf79c2ec
This commit is contained in:
parent
ca13574ba4
commit
d1a145e5e7
|
@ -113,9 +113,13 @@ int main(int argc, char **argv)
|
|||
|
||||
/* Make sure out-of-bounds category maps to DLGLOBAL */
|
||||
log_parse_category_mask(stderr_target, "DLGLOBAL,1");
|
||||
/* For IDs out of bounds of the overall osmo_log_info array */
|
||||
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");
|
||||
DEBUGP(osmo_log_info->num_cat, "You should see this on DLGLOBAL (c)\n");
|
||||
/* For IDs out of bounds of the user categories part */
|
||||
DEBUGP(log_info.num_cat + 1, "You should see this on DLGLOBAL (d)\n");
|
||||
DEBUGP(log_info.num_cat, "You should see this on DLGLOBAL (e)\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -4,3 +4,4 @@ DRLL You should see this
|
|||
DLGLOBAL You should see this on DLGLOBAL (a)
|
||||
DLGLOBAL You should see this on DLGLOBAL (b)
|
||||
DLGLOBAL You should see this on DLGLOBAL (c)
|
||||
DLGLOBAL You should see this on DLGLOBAL (e)
|
||||
|
|
Loading…
Reference in New Issue