mirror of
https://github.com/lvgl/lvgl.git
synced 2026-03-23 22:39:09 +08:00
fix(draw): resolve infinite loop and out-of-bounds access in circular mask cache calculation (#9864)
This commit is contained in:
@@ -1209,7 +1209,7 @@ static void circ_calc_aa4(lv_draw_sw_mask_radius_circle_dsc_t * c, int32_t radiu
|
||||
while(i < cir_size) {
|
||||
c->opa_start_on_y[y] = i;
|
||||
c->x_start_on_y[y] = cir_x[i];
|
||||
for(; i < (int32_t)cir_size && cir_y[i] == y; i++) {
|
||||
for(; i < (int32_t)cir_size && cir_y[i] <= y; i++) {
|
||||
c->x_start_on_y[y] = LV_MIN(c->x_start_on_y[y], cir_x[i]);
|
||||
}
|
||||
y++;
|
||||
|
||||
27
tests/src/test_cases/draw/test_draw_sw_mask.c
Normal file
27
tests/src/test_cases/draw/test_draw_sw_mask.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#if LV_BUILD_TEST
|
||||
#include "../lvgl.h"
|
||||
#include "unity/unity.h"
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
/* Function run before every test */
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
/* Function run after every test */
|
||||
lv_obj_clean(lv_screen_active());
|
||||
}
|
||||
|
||||
void test_radius_mask_overflow(void)
|
||||
{
|
||||
int width = 1280;
|
||||
int heigh = 1280;
|
||||
lv_obj_t * obj = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(obj, width * 2, heigh * 2);
|
||||
lv_obj_set_style_radius(obj, heigh, LV_PART_MAIN);
|
||||
|
||||
lv_timer_handler();
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user