From 1ea5d5730360a225c3c36d993fcf5d47e018fd4e Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Tue, 11 Feb 2025 01:00:28 -0500 Subject: [PATCH] [BugFix] TagNav Custom Menu Entry Wrong title, crashing menu Wrong title is due to the VIRT_PTR being 0 so when a NULL string is passed through P2STR() you get langid(0) that was 'Yes' now it will be 'Rockbox' the crashing menu was due to a call to retrieve entries that wasn't guarded against getting called on a menu with no entries g#5911 introduced this path to call custom_action for shuffled track adding Change-Id: I3918debbe2e79dfc9595df56b05b1ae59ba94317 --- apps/lang/english.lang | 29 +++++++++++++++-------------- apps/tagtree.c | 6 ++++-- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 5b0d76706d..1ad82dee97 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -91,6 +91,21 @@ # GoGear SA9200 gogearsa9200 # Samsung # YH820/YH920/YH925 samsungyh* + + id: LANG_ROCKBOX_TITLE + desc: main menu title + user: core + + *: "Rockbox" + + + *: "Rockbox" + + + *: "Rockbox" + + +# First item will be shown when P2STR is passed a NULL pointer id: LANG_SET_BOOL_YES desc: bool true representation @@ -353,20 +368,6 @@ *: "" - - id: LANG_ROCKBOX_TITLE - desc: main menu title - user: core - - *: "Rockbox" - - - *: "Rockbox" - - - *: "Rockbox" - - id: LANG_BOOKMARK_MENU_RECENT_BOOKMARKS desc: in the main menu diff --git a/apps/tagtree.c b/apps/tagtree.c index 30c681029d..330873c553 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -443,14 +443,14 @@ static int get_tag(int *tag) if (first == match[0] && strncasecmp(tagstr, match + 1, tagstr_len - 1) == 0) { /* check for full match */ - if ((ptrdiff_t)strlen(match) == tagstr_len) + if (match[tagstr_len] == '\0') { *tag = get_tag_symbol[i]; return 1; } } } - logf("NO MATCH: %.*s\n", tagstr_len, tagstr); + logf("NO MATCH: %.*s\n", (int)tagstr_len, tagstr); return -1; } @@ -2293,6 +2293,8 @@ int tagtree_get_filename(struct tree_context* c, char *buf, int buflen) int tagtree_get_custom_action(struct tree_context* c) { + if (c->dirlength == 0) + return 0; return tagtree_get_entry(c, c->selected_item)->customaction; }