forked from len0rd/rockbox
Patch #835815 by Henrik Backe, prevents stack overflow in .rockbox browser.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4015 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c6f234a4cc
commit
f97756e733
2 changed files with 34 additions and 13 deletions
|
@ -1767,3 +1767,8 @@ id: LANG_LINE_IN
|
||||||
desc: in settings_menu
|
desc: in settings_menu
|
||||||
eng: "Line In"
|
eng: "Line In"
|
||||||
new:
|
new:
|
||||||
|
|
||||||
|
id: LANG_NO_FILES
|
||||||
|
desc: in settings_menu
|
||||||
|
eng: "No files"
|
||||||
|
new:
|
||||||
|
|
42
apps/tree.c
42
apps/tree.c
|
@ -840,11 +840,18 @@ static bool dirbrowse(char *root, int *dirfilter)
|
||||||
memcpy(currdir,root,sizeof(currdir));
|
memcpy(currdir,root,sizeof(currdir));
|
||||||
|
|
||||||
if (*dirfilter < NUM_FILTER_MODES)
|
if (*dirfilter < NUM_FILTER_MODES)
|
||||||
start_resume(true);
|
start_resume(true);
|
||||||
|
|
||||||
numentries = showdir(currdir, dirstart, dirfilter);
|
numentries = showdir(currdir, dirstart, dirfilter);
|
||||||
if (numentries == -1)
|
if (numentries == -1)
|
||||||
return false; /* currdir is not a directory */
|
return false; /* currdir is not a directory */
|
||||||
|
|
||||||
|
if (*dirfilter > NUM_FILTER_MODES && numentries==0)
|
||||||
|
{
|
||||||
|
splash(HZ*2, 0, true, str(LANG_NO_FILES));
|
||||||
|
return false; /* No files found for rockbox_browser() */
|
||||||
|
}
|
||||||
|
|
||||||
update_all = true;
|
update_all = true;
|
||||||
|
|
||||||
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
|
put_cursorxy(CURSOR_X, CURSOR_Y + dircursor, true);
|
||||||
|
@ -1171,10 +1178,13 @@ static bool dirbrowse(char *root, int *dirfilter)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TREE_MENU:
|
case TREE_MENU:
|
||||||
lcd_stop_scroll();
|
if (*dirfilter < NUM_FILTER_MODES)
|
||||||
if (main_menu())
|
{
|
||||||
reload_root = true;
|
lcd_stop_scroll();
|
||||||
restore = true;
|
if (main_menu())
|
||||||
|
reload_root = true;
|
||||||
|
restore = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUTTON_ON:
|
case BUTTON_ON:
|
||||||
|
@ -1206,19 +1216,25 @@ static bool dirbrowse(char *root, int *dirfilter)
|
||||||
|
|
||||||
#ifdef HAVE_RECORDER_KEYPAD
|
#ifdef HAVE_RECORDER_KEYPAD
|
||||||
case BUTTON_F2:
|
case BUTTON_F2:
|
||||||
if (f2_screen())
|
if (*dirfilter < NUM_FILTER_MODES)
|
||||||
reload_root = true;
|
{
|
||||||
restore = true;
|
if (f2_screen())
|
||||||
break;
|
reload_root = true;
|
||||||
|
restore = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case BUTTON_F3:
|
case BUTTON_F3:
|
||||||
if (f3_screen())
|
if (*dirfilter < NUM_FILTER_MODES)
|
||||||
reload_root = true;
|
{
|
||||||
|
if (f3_screen())
|
||||||
|
reload_root = true;
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
|
tree_max_on_screen = (LCD_HEIGHT - MARGIN_Y) / fh;
|
||||||
#endif
|
#endif
|
||||||
restore = true;
|
restore = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue