1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

fix(bin_decoder): check buffer size before write data

The decompressed data could be larger than draw buffer size. Check and report error for this case.

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
Neo Xu 2024-06-26 11:02:31 +08:00 committed by Gabor Kiss-Vamosi
parent dd70291e4c
commit 75eef0d209

View File

@ -1088,6 +1088,12 @@ static lv_result_t decompress_image(lv_image_decoder_dsc_t * dsc, const lv_image
return LV_RESULT_INVALID;
}
if(out_len > decompressed->data_size) {
LV_LOG_ERROR("Decompressed size mismatch: %" LV_PRIu32 " > %" LV_PRIu32, out_len, decompressed->data_size);
lv_draw_buf_destroy_user(image_cache_draw_buf_handlers, decompressed);
return LV_RESULT_INVALID;
}
img_data = decompressed->data;
if(compressed->method == LV_IMAGE_COMPRESS_RLE) {