plugins: properties: fix stack overflow in db

Stack overflow in splash_progress called from
tagtree_subentries_do_action with stack protector
enabled on mips

Change-Id: Ia71e0493e279af0531ae792d41442198555664f6
This commit is contained in:
Christian Soffke 2026-05-28 22:50:33 +02:00 committed by Solomon Peachy
parent f0d3d76b26
commit 9f20c45a5e
6 changed files with 31 additions and 28 deletions

View file

@ -353,6 +353,7 @@ static const struct plugin_api rockbox_api = {
gui_synclist_del_item, gui_synclist_del_item,
gui_synclist_do_button, gui_synclist_do_button,
gui_synclist_set_title, gui_synclist_set_title,
gui_synclist_scroll_stop,
gui_syncyesno_run, gui_syncyesno_run,
simplelist_info_init, simplelist_info_init,
simplelist_show_list, simplelist_show_list,
@ -488,6 +489,7 @@ static const struct plugin_api rockbox_api = {
talk_force_enqueue_next, talk_force_enqueue_next,
/* kernel/ system */ /* kernel/ system */
panicf,
#if defined(ARM_NEED_DIV0) #if defined(ARM_NEED_DIV0)
__div0, __div0,
#endif #endif
@ -562,7 +564,9 @@ static const struct plugin_api rockbox_api = {
__cyg_profile_func_exit, __cyg_profile_func_exit,
#endif #endif
add_event, add_event,
add_event_ex,
remove_event, remove_event,
remove_event_ex,
send_event, send_event,
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) #if (CONFIG_PLATFORM & PLATFORM_HOSTED)
@ -578,6 +582,7 @@ static const struct plugin_api rockbox_api = {
vsnprintf, vsnprintf,
vuprintf, vuprintf,
strcpy, strcpy,
strncpy,
strlcpy, strlcpy,
strlen, strlen,
strrchr, strrchr,
@ -711,7 +716,7 @@ static const struct plugin_api rockbox_api = {
tagcache_fill_tags, tagcache_fill_tags,
#endif #endif
#endif #endif
tagtree_subentries_do_action, tagtree_entries_iterate,
#endif /* HAVE_TAGCACHE */ #endif /* HAVE_TAGCACHE */
#ifdef HAVE_ALBUMART #ifdef HAVE_ALBUMART
@ -871,11 +876,6 @@ static const struct plugin_api rockbox_api = {
/* new stuff at the end, sort into place next time /* new stuff at the end, sort into place next time
the API gets incompatible */ the API gets incompatible */
panicf,
gui_synclist_scroll_stop,
add_event_ex,
remove_event_ex,
strncpy,
}; };
static int plugin_buffer_handle; static int plugin_buffer_handle;

View file

@ -180,7 +180,7 @@ int plugin_open(const char *plugin, const char *parameter);
* when this happens please take the opportunity to sort in * when this happens please take the opportunity to sort in
* any new functions "waiting" at the end of the list. * any new functions "waiting" at the end of the list.
*/ */
#define PLUGIN_API_VERSION 282 #define PLUGIN_API_VERSION 283
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */ /* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
@ -413,6 +413,7 @@ struct plugin_api {
bool (*gui_synclist_do_button)(struct gui_synclist * lists, int *action); bool (*gui_synclist_do_button)(struct gui_synclist * lists, int *action);
void (*gui_synclist_set_title)(struct gui_synclist *lists, const char* title, void (*gui_synclist_set_title)(struct gui_synclist *lists, const char* title,
enum themable_icons icon); enum themable_icons icon);
void (*gui_synclist_scroll_stop)(struct gui_synclist *lists);
enum yesno_res (*gui_syncyesno_run)(const struct text_message * main_message, enum yesno_res (*gui_syncyesno_run)(const struct text_message * main_message,
const struct text_message * yes_message, const struct text_message * yes_message,
const struct text_message * no_message); const struct text_message * no_message);
@ -568,6 +569,7 @@ struct plugin_api {
void (*talk_force_enqueue_next)(void); void (*talk_force_enqueue_next)(void);
/* kernel/ system */ /* kernel/ system */
void (*panicf)(const char *msg, ...);
#if defined(ARM_NEED_DIV0) #if defined(ARM_NEED_DIV0)
void (*__div0)(void); void (*__div0)(void);
#endif #endif
@ -654,7 +656,17 @@ struct plugin_api {
#endif #endif
/* event api */ /* event api */
bool (*add_event)(unsigned short id, void (*handler)(unsigned short id, void *data)); bool (*add_event)(unsigned short id, void (*handler)(unsigned short id, void *data));
bool (*add_event_ex)(unsigned short id, bool oneshot,
void (*handler)(unsigned short id,
void *event_data,
void *user_data),
void *user_data);
void (*remove_event)(unsigned short id, void (*handler)(unsigned short id, void *data)); void (*remove_event)(unsigned short id, void (*handler)(unsigned short id, void *data));
void (*remove_event_ex)(unsigned short id,
void (*handler)(unsigned short id,
void *event_data,
void *user_data),
void *user_data);
void (*send_event)(unsigned short id, void *data); void (*send_event)(unsigned short id, void *data);
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) #if (CONFIG_PLATFORM & PLATFORM_HOSTED)
@ -671,6 +683,7 @@ struct plugin_api {
int (*vsnprintf)(char *buf, size_t size, const char *fmt, va_list ap); int (*vsnprintf)(char *buf, size_t size, const char *fmt, va_list ap);
int (*vuprintf)(vuprintf_push_cb push, void *userp, const char *fmt, va_list ap); int (*vuprintf)(vuprintf_push_cb push, void *userp, const char *fmt, va_list ap);
char* (*strcpy)(char *dst, const char *src); char* (*strcpy)(char *dst, const char *src);
char* (*strncpy)(char * dst, const char * src, size_t count);
size_t (*strlcpy)(char *dst, const char *src, size_t length); size_t (*strlcpy)(char *dst, const char *src, size_t length);
size_t (*strlen)(const char *str); size_t (*strlen)(const char *str);
char * (*strrchr)(const char *s, int c); char * (*strrchr)(const char *s, int c);
@ -829,7 +842,8 @@ struct plugin_api {
bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename); bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename);
#endif #endif
#endif #endif
bool (*tagtree_subentries_do_action)(bool (*action_cb)(const char *file_name)); bool (*tagtree_entries_iterate)(bool (*action_cb)(const char *file_name),
char *buf, size_t buf_sz);
#endif /* HAVE_TAGCACHE */ #endif /* HAVE_TAGCACHE */
#ifdef HAVE_ALBUMART #ifdef HAVE_ALBUMART
@ -1025,19 +1039,6 @@ struct plugin_api {
/* new stuff at the end, sort into place next time /* new stuff at the end, sort into place next time
the API gets incompatible */ the API gets incompatible */
void (*panicf)(const char *msg, ...);
void (*gui_synclist_scroll_stop)(struct gui_synclist *lists);
bool (*add_event_ex)(unsigned short id, bool oneshot,
void (*handler)(unsigned short id,
void *event_data,
void *user_data),
void *user_data);
void (*remove_event_ex)(unsigned short id,
void (*handler)(unsigned short id,
void *event_data,
void *user_data),
void *user_data);
char* (*strncpy)(char * dst, const char * src, size_t count);
}; };
/* plugin header */ /* plugin header */

View file

@ -307,7 +307,8 @@ static bool assemble_track_info(const char *filename, struct dir_stats *stats)
return false; return false;
#ifdef HAVE_TAGCACHE #ifdef HAVE_TAGCACHE
else if (props_type == PROPS_MUL_ID3 && else if (props_type == PROPS_MUL_ID3 &&
!rb->tagtree_subentries_do_action(&mul_id3_add)) !rb->tagtree_entries_iterate(&mul_id3_add, str_filename,
sizeof str_filename))
return false; return false;
#endif #endif

View file

@ -2649,17 +2649,17 @@ static bool tagtree_insert_selection(int position, bool queue,
return ret; return ret;
} }
/* Execute action_cb for all subentries of the current table's /* Execute action_cb for all entries of the current table's
* selected item, handing over each entry's filename in the * selected item, handing over each entry's filename in the
* callback function parameter. Parameter will be NULL for * callback function parameter. Parameter will be NULL for
* entries whose filename couldn't be retrieved. * entries whose filename couldn't be retrieved.
*/ */
bool tagtree_subentries_do_action(bool (*action_cb)(const char *file_name)) bool tagtree_entries_iterate(bool (*action_cb)(const char *file_name),
char* buf, size_t buf_sz)
{ {
struct tagcache_search tcs; struct tagcache_search tcs;
int i, n; int i, n;
unsigned long last_tick; unsigned long last_tick;
char buf[MAX_PATH];
int ret = true; int ret = true;
int dirlevel = tc->dirlevel; int dirlevel = tc->dirlevel;
int selected_item = tc->selected_item; int selected_item = tc->selected_item;
@ -2685,7 +2685,7 @@ bool tagtree_subentries_do_action(bool (*action_cb)(const char *file_name))
} }
if (!action_cb(tagcache_retrieve(&tcs, tagtree_get_entry(tc, i)->extraseek, if (!action_cb(tagcache_retrieve(&tcs, tagtree_get_entry(tc, i)->extraseek,
tcs.type, buf, sizeof buf) ? buf : NULL)) tcs.type, buf, buf_sz) ? buf : NULL))
{ {
ret = false; ret = false;
break; break;

View file

@ -47,7 +47,8 @@ int tagtree_get_icon(struct tree_context* c);
int tagtree_get_filename(struct tree_context* c, char *buf, int buflen); int tagtree_get_filename(struct tree_context* c, char *buf, int buflen);
int tagtree_get_custom_action(struct tree_context* c); int tagtree_get_custom_action(struct tree_context* c);
bool tagtree_get_subentry_filename(char *buf, size_t bufsize); bool tagtree_get_subentry_filename(char *buf, size_t bufsize);
bool tagtree_subentries_do_action(bool (*action_cb)(const char *file_name)); bool tagtree_entries_iterate(bool (*action_cb)(const char *file_name),
char *buf, size_t buf_sz);
#endif #endif
#endif #endif

View file

@ -2765,7 +2765,7 @@ void tagcache_search_set_uniqbuf(struct tagcache_search *tcs, void *buffer, long
\param length \param length
\description \description
bool tagtree_subentries_do_action(bool (*action_cb)(const char *file_name)) bool tagtree_entries_iterate(bool (*action_cb)(const char *file_name), char* buf, size_t buf_sz)
\group metadata \group metadata
\conditions (defined(HAVE_TAGCACHE)) \conditions (defined(HAVE_TAGCACHE))
\param action_cb \param action_cb