InfiniTimeOrg / InfiniSim

Simulator for InfiniTime user interface without needing a PineTime
GNU General Public License v3.0
164 stars 66 forks source link

(lvgl Bug report) Assigning a uint16_t to uint8_t lead ids_size to 0 when load cmaps. #98

Closed chou-o-ning closed 1 year ago

chou-o-ning commented 1 year ago

File: InfiniSim/InfiniTime/src/libs/lvgl/src/lv_font/lv_font_loader.c Line: 269 Descirption: Assigning a uint16_t (cmap_table[i].data_entries_count ) to uint8_t (ids_size) may lead ids_size to 0. Envirement: kvm virtual machine (Ubuntu 20.04 AMD64) on Ubuntu 20.04 AMD64, when I add a chinese font to little fs. InfiniSim display chinese font error. When I debug into it, I find ids_size is 0 when load cmaps. Change uint8_t to uint16_t will fix this.

    switch(cmap_table[i].format_type) {
        case LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL: {
                uint8_t ids_size = sizeof(uint8_t) * cmap_table[i].data_entries_count;
                uint8_t * glyph_id_ofs_list = lv_mem_alloc(ids_size);
NeroBurner commented 1 year ago

is this specific to infiniSim, or does the same thing happen on the actual PineTime?

NeroBurner commented 1 year ago

can the Chinese font be compiled using utf8 glyphs instead of the unexpected utf16 ones?

Generally this seems to me like a lvgl problem or a InfiniTime problem. Please open an issue at those projects as there is nothing InfiniSim can do to fix this problem