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.

unicode: Explicitly set INT_MAX for unlimited utf8_size

-1 could be supplied unintentionally from user code when utf8_size is computable value

Fixup for 004304dc and 1f548f74

Change-Id: I93008ea289bdb134f051975c25b0db9d0e64b823

authored by

Roman Artiukhin and committed by
Solomon Peachy
059df378 44e97b9e

+3 -9
+3 -9
firmware/common/unicode.c
··· 280 280 281 281 unsigned char* iso_decode(const unsigned char *iso, unsigned char *utf8, int cp, int count) 282 282 { 283 - return iso_decode_ex(iso, utf8, cp, count, -1); 283 + return iso_decode_ex(iso, utf8, cp, count, INT_MAX); 284 284 } 285 285 286 286 /* Recode an iso encoded string to UTF-8 */ 287 287 unsigned char* iso_decode_ex(const unsigned char *iso, unsigned char *utf8, int cp, int count, int utf8_size) 288 288 { 289 - if (utf8_size == -1) 290 - utf8_size = INT_MAX; 291 - 292 289 uint16_t *table = NULL; 293 290 294 291 cp_lock_enter(); ··· 423 420 unsigned char* utf16decode(const unsigned char *utf16, unsigned char *utf8, 424 421 int count, int utf8_size, bool le) 425 422 { 426 - if (utf8_size == -1) 427 - utf8_size = INT_MAX; 428 - 429 423 // little-endian flag is used as significant byte index 430 424 if (le) 431 425 le = 1; ··· 453 447 unsigned char* utf16LEdecode(const unsigned char *utf16, unsigned char *utf8, 454 448 int count) 455 449 { 456 - return utf16decode(utf16, utf8, count, -1, true); 450 + return utf16decode(utf16, utf8, count, INT_MAX, true); 457 451 } 458 452 459 453 unsigned char* utf16BEdecode(const unsigned char *utf16, unsigned char *utf8, 460 454 int count) 461 455 { 462 - return utf16decode(utf16, utf8, count, -1, false); 456 + return utf16decode(utf16, utf8, count, INT_MAX, false); 463 457 } 464 458 465 459 bool utf16_has_bom(const unsigned char *utf16, bool *le)