LVGL Mirror extension crash (#25165)

This commit is contained in:
s-hadinger authored and GitHub committed 2026-10-20 18:53:01 +02:00
1 parent 872daa8695
commit a42b458105
7 files changed
+1569 -1558

No files matched your search

+1
View File
@@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file.
### Fixed
- Several buffer overflows
- MiEL HVAC Modbus no response timeouts now serves the RS485 slave from its own task (#25157)
- LVGL Mirror extension crash
### Removed
File diff suppressed because it is too large. Load diff
@@ -2,18 +2,7 @@
* Generated code, don't edit
*******************************************************************/
extern int be_ntv_lv_style_init(bvm *vm);
extern int be_ntv_lv_font_init(bvm *vm);
extern int be_ntv_lv_color_init(bvm *vm);
extern int be_ntv_lv_theme_init(bvm *vm);
extern int be_ntv_lv_group_init(bvm *vm);
extern int be_ntv_lv_obj_init(bvm *vm);
extern int be_ntv_lv_event_init(bvm *vm);
extern int be_ntv_lv_display_init(bvm *vm);
extern int be_ntv_lv_indev_init(bvm *vm);
extern int be_ntv_lv_qrcode_init(bvm *vm);
extern int be_ntv_lv_anim_init(bvm *vm);
extern int be_ntv_lv_timer_init(bvm *vm);
extern int be_ntv_lv_animimg_init(bvm *vm);
extern int be_ntv_lv_arc_init(bvm *vm);
extern int be_ntv_lv_arclabel_init(bvm *vm);
@@ -24,20 +13,29 @@ extern int be_ntv_lv_calendar_init(bvm *vm);
extern int be_ntv_lv_canvas_init(bvm *vm);
extern int be_ntv_lv_chart_init(bvm *vm);
extern int be_ntv_lv_checkbox_init(bvm *vm);
extern int be_ntv_lv_color_init(bvm *vm);
extern int be_ntv_lv_colorwheel_init(bvm *vm);
extern int be_ntv_lv_display_init(bvm *vm);
extern int be_ntv_lv_dropdown_init(bvm *vm);
extern int be_ntv_lv_event_init(bvm *vm);
extern int be_ntv_lv_font_init(bvm *vm);
extern int be_ntv_lv_group_init(bvm *vm);
extern int be_ntv_lv_image_init(bvm *vm);
extern int be_ntv_lv_imagebutton_init(bvm *vm);
extern int be_ntv_lv_indev_init(bvm *vm);
extern int be_ntv_lv_keyboard_init(bvm *vm);
extern int be_ntv_lv_label_init(bvm *vm);
extern int be_ntv_lv_led_init(bvm *vm);
extern int be_ntv_lv_line_init(bvm *vm);
extern int be_ntv_lv_list_init(bvm *vm);
extern int be_ntv_lv_menu_init(bvm *vm);
extern int be_ntv_lv_menu_page_init(bvm *vm);
extern int be_ntv_lv_menu_cont_init(bvm *vm);
extern int be_ntv_lv_menu_page_init(bvm *vm);
extern int be_ntv_lv_menu_section_init(bvm *vm);
extern int be_ntv_lv_menu_separator_init(bvm *vm);
extern int be_ntv_lv_msgbox_init(bvm *vm);
extern int be_ntv_lv_obj_init(bvm *vm);
extern int be_ntv_lv_qrcode_init(bvm *vm);
extern int be_ntv_lv_roller_init(bvm *vm);
extern int be_ntv_lv_scale_init(bvm *vm);
extern int be_ntv_lv_scale_section_init(bvm *vm);
@@ -46,13 +44,15 @@ extern int be_ntv_lv_span_init(bvm *vm);
extern int be_ntv_lv_spangroup_init(bvm *vm);
extern int be_ntv_lv_spinbox_init(bvm *vm);
extern int be_ntv_lv_spinner_init(bvm *vm);
extern int be_ntv_lv_stripes_init(bvm *vm);
extern int be_ntv_lv_style_init(bvm *vm);
extern int be_ntv_lv_switch_init(bvm *vm);
extern int be_ntv_lv_table_init(bvm *vm);
extern int be_ntv_lv_tabview_init(bvm *vm);
extern int be_ntv_lv_textarea_init(bvm *vm);
extern int be_ntv_lv_theme_init(bvm *vm);
extern int be_ntv_lv_tileview_init(bvm *vm);
extern int be_ntv_lv_colorwheel_init(bvm *vm);
extern int be_ntv_lv_stripes_init(bvm *vm);
extern int be_ntv_lv_timer_init(bvm *vm);
extern const bclass be_class_lv_anim;
extern const bclass be_class_lv_animimg;
@@ -21,11 +21,14 @@ extern int lv0_load_font(bvm *vm);
extern lv_ts_calibration_t * lv_get_ts_calibration(void);
// LVGL 9.6: NULL display is deprecated, and with LV_USE_CHECK_ARG 0 a NULL default display crashes; return 0 if no display (9.5 behavior)
static int lv_get_hor_res(void) {
return lv_display_get_horizontal_resolution(lv_display_get_default()); // LVGL 9.6: NULL display is deprecated
lv_display_t * disp = lv_display_get_default();
return disp ? lv_display_get_horizontal_resolution(disp) : 0;
}
static int lv_get_ver_res(void) {
return lv_display_get_vertical_resolution(lv_display_get_default()); // LVGL 9.6: NULL display is deprecated
lv_display_t * disp = lv_display_get_default();
return disp ? lv_display_get_vertical_resolution(disp) : 0;
}
/* `lv` methods */
@@ -187,17 +187,6 @@ extern void arc_anim_start_angle(void * obj, int32_t v);
extern void arc_anim_end_angle(void * obj, int32_t v);
/********************************************************************
** Solidified class: lv_qrcode
********************************************************************/
#include "be_fixed_be_class_lv_qrcode.h"
/* @const_object_info_begin
class be_class_lv_qrcode (scope: global, name: lv_qrcode, super: be_class_lv_obj, strings: weak) {
init, func(be_ntv_lv_qrcode_init)
_class, comptr(&lv_qrcode_class)
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_animimg
********************************************************************/
@@ -308,6 +297,17 @@ class be_class_lv_checkbox (scope: global, name: lv_checkbox, super: be_class_lv
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_colorwheel
********************************************************************/
#include "be_fixed_be_class_lv_colorwheel.h"
/* @const_object_info_begin
class be_class_lv_colorwheel (scope: global, name: lv_colorwheel, super: be_class_lv_obj, strings: weak) {
init, func(be_ntv_lv_colorwheel_init)
_class, comptr(&lv_colorwheel_class)
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_dropdown
********************************************************************/
@@ -407,17 +407,6 @@ class be_class_lv_menu (scope: global, name: lv_menu, super: be_class_lv_obj, st
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_menu_page
********************************************************************/
#include "be_fixed_be_class_lv_menu_page.h"
/* @const_object_info_begin
class be_class_lv_menu_page (scope: global, name: lv_menu_page, super: be_class_lv_obj, strings: weak) {
init, func(be_ntv_lv_menu_page_init)
_class, comptr(&lv_menu_page_class)
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_menu_cont
********************************************************************/
@@ -429,6 +418,17 @@ class be_class_lv_menu_cont (scope: global, name: lv_menu_cont, super: be_class_
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_menu_page
********************************************************************/
#include "be_fixed_be_class_lv_menu_page.h"
/* @const_object_info_begin
class be_class_lv_menu_page (scope: global, name: lv_menu_page, super: be_class_lv_obj, strings: weak) {
init, func(be_ntv_lv_menu_page_init)
_class, comptr(&lv_menu_page_class)
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_menu_section
********************************************************************/
@@ -462,6 +462,17 @@ class be_class_lv_msgbox (scope: global, name: lv_msgbox, super: be_class_lv_obj
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_qrcode
********************************************************************/
#include "be_fixed_be_class_lv_qrcode.h"
/* @const_object_info_begin
class be_class_lv_qrcode (scope: global, name: lv_qrcode, super: be_class_lv_obj, strings: weak) {
init, func(be_ntv_lv_qrcode_init)
_class, comptr(&lv_qrcode_class)
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_roller
********************************************************************/
@@ -551,6 +562,17 @@ class be_class_lv_spinner (scope: global, name: lv_spinner, super: be_class_lv_a
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_stripes
********************************************************************/
#include "be_fixed_be_class_lv_stripes.h"
/* @const_object_info_begin
class be_class_lv_stripes (scope: global, name: lv_stripes, super: be_class_lv_obj, strings: weak) {
init, func(be_ntv_lv_stripes_init)
_class, comptr(&lv_stripes_class)
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_switch
********************************************************************/
@@ -606,25 +628,3 @@ class be_class_lv_tileview (scope: global, name: lv_tileview, super: be_class_lv
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_colorwheel
********************************************************************/
#include "be_fixed_be_class_lv_colorwheel.h"
/* @const_object_info_begin
class be_class_lv_colorwheel (scope: global, name: lv_colorwheel, super: be_class_lv_obj, strings: weak) {
init, func(be_ntv_lv_colorwheel_init)
_class, comptr(&lv_colorwheel_class)
}
@const_object_info_end */
/********************************************************************
** Solidified class: lv_stripes
********************************************************************/
#include "be_fixed_be_class_lv_stripes.h"
/* @const_object_info_begin
class be_class_lv_stripes (scope: global, name: lv_stripes, super: be_class_lv_obj, strings: weak) {
init, func(be_ntv_lv_stripes_init)
_class, comptr(&lv_stripes_class)
}
@const_object_info_end */
@@ -636,13 +636,12 @@ def parse_functions(mapper, lv_funcs_file):
"""Parse ``lv_funcs.h`` and classify every supported function.
Returns ``(lv, lv0)`` where:
- ``lv`` is an ordered dict ``subtype -> [LvglFunction, ...]`` for every
- ``lv`` is a dict ``subtype -> [LvglFunction, ...]``, sorted by subtype, for every
class/widget method (the first argument, the implicit ``self``, is
stripped from the documentation).
- ``lv0`` is the list of global ``lv.*`` functions.
"""
# Pre-seed the synthetic LVGL8 classes so they keep a stable position at the
# front of the generated output (insertion order is significant).
# Pre-seed the synthetic LVGL8 classes so they exist even without functions
lv = {c: [] for c in SYNTHETIC_CLASSES}
lv0 = [] # functions in the `lv` module
@@ -699,7 +698,9 @@ def parse_functions(mapper, lv_funcs_file):
for n in get_synonyms(be_name):
lv0.append(LvglFunction(mapper, be_func_name, c_ret, c_args, c_args_doc_list, c_func_name, n))
return (lv, lv0)
# deterministic output: classes in alphabetical order, independent of the
# order in which their functions first appear in the LVGL headers
return (dict(sorted(lv.items())), lv0)
def parse_constants(lv_enum_file):
@@ -893,11 +894,13 @@ def print_method_tables_header(out, classes, extra_names=()):
``extra_names`` are added to the name blob (ex: generic style properties)."""
all_names = list(extra_names)
sigs = {}
sig_keys = set()
for entries in classes.values():
for be_name, f in entries.items():
all_names.append(method_verb(be_name)[1])
sigs.setdefault((f.c_ret_type, f.c_argc), len(sigs))
sig_keys.add((f.c_ret_type, f.c_argc))
# deterministic output: signatures indexed in alphabetical order
sigs = {k: i for i, k in enumerate(sorted(sig_keys))}
if len(sigs) >= (1 << METHOD_SIG_BITS):
raise ValueError(f"too many method signatures: {len(sigs)}")
pieces, offsets = build_name_blob(all_names)
@@ -954,7 +957,7 @@ STYLE_TYPES_MAX = 32 # type index is 5 bits
def scan_small_typedefs(include_dir):
"""Return ``{type_name: c_kind}`` for types declared as ``typedef uint8_t/uint16_t <name>;``."""
kinds = {}
for h in Path(include_dir).rglob('*.h'):
for h in sorted(Path(include_dir).rglob('*.h')):
for base, name in re.findall(r'typedef\s+(u?int8_t|u?int16_t)\s+(\w+)\s*;', h.read_text(errors='replace')):
# signed small types are not supported (None), they stay explicit methods
kinds[name] = None if not base.startswith('u') else ('u16' if '16' in base else 'u8')
@@ -1075,10 +1078,11 @@ def split_style_methods(classes):
del entries[be_name] # resolved at runtime, no method entry
# drop names that ended with no accessor (only possible after a conflict)
props = {k: v for k, v in props.items() if v['flags']}
types = {}
# deterministic output: types indexed in alphabetical order
keys = sorted({(e['value_arg'] or "", e['ret'] or "", e['kind']) for e in props.values()})
types = {k: i for i, k in enumerate(keys)}
for e in props.values():
key = (e['value_arg'] or "", e['ret'] or "", e['kind'])
e['type'] = types.setdefault(key, len(types))
e['type'] = types[(e['value_arg'] or "", e['ret'] or "", e['kind'])]
if len(types) > STYLE_TYPES_MAX:
raise ValueError(f"too many style types: {len(types)}")
return props, types
@@ -1464,11 +1468,14 @@ extern int lv0_load_font(bvm *vm);
extern lv_ts_calibration_t * lv_get_ts_calibration(void);
// LVGL 9.6: NULL display is deprecated, and with LV_USE_CHECK_ARG 0 a NULL default display crashes; return 0 if no display (9.5 behavior)
static int lv_get_hor_res(void) {
return lv_display_get_horizontal_resolution(lv_display_get_default()); // LVGL 9.6: NULL display is deprecated
lv_display_t * disp = lv_display_get_default();
return disp ? lv_display_get_horizontal_resolution(disp) : 0;
}
static int lv_get_ver_res(void) {
return lv_display_get_vertical_resolution(lv_display_get_default()); // LVGL 9.6: NULL display is deprecated
lv_display_t * disp = lv_display_get_default();
return disp ? lv_display_get_vertical_resolution(disp) : 0;
}
/* `lv` methods */
@@ -207,9 +207,9 @@ SYNONYM_FUNCTIONS = {
"set_range": "set_axis_range",
}
# Synthetic classes seeded (in this order) before parsing, so they keep a
# stable position at the front of the generated output. These LVGL8-style
# classes have no auto-detected `_create` function.
# Synthetic classes seeded before parsing, so they exist even without any
# parsed function. These LVGL8-style classes have no auto-detected `_create`
# function. Generated output lists all classes in alphabetical order.
SYNTHETIC_CLASSES = ['style', 'font', 'color', 'theme']
# Generic style accessors (flash saving): `lv_obj.set_style_<prop>()`,