Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

sb_create_from_settings: Fix crash when ui viewport setting malformed

The 'Purple_Glow_V3' theme uses the following
'UI viewport' setting which is missing a comma
after the viewport height:

ui viewport: 0,0,271,212-,-,-

The setting is actually ignored when loading this theme,
since a UI viewport is already defined in the supplied
SBS file.

Rockbox will crash, though, when and if the next theme
that is loaded resets the SBS by setting it to "-", but
doesn't adjust the UI viewport setting at the same time.

To fix, use default UI viewport when encountering fewer
parameters than expected for the UI viewport setting.

Change-Id: I2648565ac59369ce8ab18d8e84b7fa69ad767f25

+10 -4
+10 -4
apps/gui/statusbar-skinned.c
··· 252 252 comma = strchr(comma+1, ','); 253 253 254 254 } while (comma && param_count < 6); 255 - if (comma) 255 + if (comma && strchr(comma+1, ',')) 256 256 { 257 257 char *end = comma; 258 258 char fg[8], bg[8]; 259 259 int i = 0; 260 260 comma++; 261 - while (*comma != ',') 261 + while (*comma != ',' && i < (int) sizeof(fg) - 1) 262 262 fg[i++] = *comma++; 263 263 fg[i] = '\0'; comma++; i=0; 264 - while (*comma != ')') 264 + while (*comma != ')' && i < (int) sizeof(bg) - 1) 265 265 bg[i++] = *comma++; 266 266 bg[i] = '\0'; 267 267 len += snprintf(end, remaining-len, ") %%Vf(%s) %%Vb(%s)\n", fg, bg); 268 268 } 269 + else 270 + { 271 + ptr2[0] = '-'; 272 + ptr2[1] = '\0'; 273 + } 269 274 } 270 - else 275 + 276 + if (!ptr2[0] || ptr2[0] == '-') 271 277 { 272 278 int y = 0, height; 273 279 switch (bar_position)