From 010535674cc91786276afae7b12669ea36304866 Mon Sep 17 00:00:00 2001 From: pansila Date: Fri, 2 Jun 2023 10:34:54 +0800 Subject: [PATCH] [fix] failed to parse bin when cfgtablelen is 0 --- BL808Image.bt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BL808Image.bt b/BL808Image.bt index f82e45e..780c2cb 100644 --- a/BL808Image.bt +++ b/BL808Image.bt @@ -231,7 +231,13 @@ if (BootHeader.magic != 0x504e4642) return 1; } -if(BootHeader.flashCfgTableAddr < FileSize() && +if(BootHeader.flashCfgTableLen == 0) +{ + Warning("Configuration table length is 0.\n"); + return 1; +} + +if (BootHeader.flashCfgTableAddr < FileSize() && BootHeader.flashCfgTableAddr + BootHeader.flashCfgTableLen <= FileSize()) { FSeek(BootHeader.flashCfgTableAddr); local quad num_configs = (BootHeader.flashCfgTableLen - 8) / 8; -- Gitee