fix(bmp): reject truncated files in decoder_info (#10350)

Signed-off-by: ychsiao168 <yungchunghsiao@pm.me>
Co-authored-by: ychsiao168 <yungchunghsiao@pm.me>
This commit is contained in:
ychsiao168
2026-07-20 11:08:03 +02:00
committed by GitHub
co-authored by ychsiao168
parent 3b85eef470
commit 9eef0bc3be
+6 -1
View File
@@ -102,7 +102,12 @@ static lv_result_t decoder_info(lv_image_decoder_t * decoder, lv_image_decoder_d
/*Save the data in the header*/
uint8_t headers[54];
lv_fs_read(&dsc->file, headers, 54, NULL);
uint32_t rn = 0;
lv_fs_res_t res = lv_fs_read(&dsc->file, headers, 54, &rn);
if(res != LV_FS_RES_OK || rn < 54) {
return LV_RESULT_INVALID;
}
uint32_t w;
uint32_t h;
lv_memcpy(&w, headers + 18, 4);