mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-04-11 16:37:45 -04:00
diacritic: Critical bugfixes
* When the codepoint > 0xffff, don't overflow past the end
of our diacritic table (Fixed by William Wilgus)
* Truncation of the 'info' field causes the RTL flag to be dropped
(RTL flag is b15 but we truncate it into an 8-bit variable)
Both bugs introduced in a2c10f6189 (September 2025)
Change-Id: Id5425606f2cf91d3b3a81f4b67a97d546de81e41
This commit is contained in:
parent
86f5665cd0
commit
c72ffa7a9a
1 changed files with 10 additions and 2 deletions
|
|
@ -203,9 +203,15 @@ bool is_diacritic(const ucschar_t char_code, bool *is_rtl)
|
||||||
static uint8_t diacritic_mru[MRU_MAX_LEN];
|
static uint8_t diacritic_mru[MRU_MAX_LEN];
|
||||||
|
|
||||||
uint8_t i, itmp;
|
uint8_t i, itmp;
|
||||||
uint8_t info, mru;
|
uint8_t mru;
|
||||||
|
uint16_t info;
|
||||||
|
|
||||||
const struct diac_range *diac;
|
const struct diac_range *diac = &diac_ranges[DIAC_NUM_RANGES - 1];
|
||||||
|
|
||||||
|
/* If the codepoint exceeds the terminating entry in our table
|
||||||
|
then treat it as non-diacritic. */
|
||||||
|
if (char_code >= diac->base)
|
||||||
|
goto bypass;
|
||||||
|
|
||||||
/* Search in MRU */
|
/* Search in MRU */
|
||||||
for (mru = 0, i = 0; mru < mru_len; mru++)
|
for (mru = 0, i = 0; mru < mru_len; mru++)
|
||||||
|
|
@ -244,6 +250,8 @@ Found:
|
||||||
diacritic_mru[0] = i;
|
diacritic_mru[0] = i;
|
||||||
|
|
||||||
diac = &diac_ranges[i];
|
diac = &diac_ranges[i];
|
||||||
|
|
||||||
|
bypass:
|
||||||
info = diac->info;
|
info = diac->info;
|
||||||
|
|
||||||
/* Update RTL */
|
/* Update RTL */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue