From 4ed21a1f1acaa58b48bc543471f2f8e2b56f88ef Mon Sep 17 00:00:00 2001 From: maximum2974 Date: Wed, 30 Jul 2025 17:27:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20FA=E6=A8=A1=E5=9E=8B=E6=89=93?= =?UTF-8?q?=E5=8C=85app=E5=91=8A=E8=AD=A6=E6=97=A5=E5=BF=97=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: maximum2974 --- adapter/ohos/Compressor.java | 7 +++++++ .../frameworks/src/json/module_json_utils.cpp | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/adapter/ohos/Compressor.java b/adapter/ohos/Compressor.java index 99f0dbb0..53b2d30a 100644 --- a/adapter/ohos/Compressor.java +++ b/adapter/ohos/Compressor.java @@ -3342,6 +3342,13 @@ public class Compressor { hapVerifyInfo.setStageModule(false); hapVerifyInfo.setFileLength(FileUtils.getFileSize(filePath)); ModuleJsonUtil.parseFAHapVerifyInfo(hapVerifyInfo); + File srcFile = new File(filePath); + String fileStr = srcFile.getName(); + if(fileStr.toLowerCase(Locale.ENGLISH).endsWith(HAP_SUFFIX)){ + hapVerifyInfo.setFileType(HAP_SUFFIX); + }else if (fileStr.toLowerCase(Locale.ENGLISH).endsWith(HSP_SUFFIX)){ + hapVerifyInfo.setFileType(HSP_SUFFIX); + } return hapVerifyInfo; } diff --git a/packing_tool/frameworks/src/json/module_json_utils.cpp b/packing_tool/frameworks/src/json/module_json_utils.cpp index 7fbdb2bc..c0cfea32 100644 --- a/packing_tool/frameworks/src/json/module_json_utils.cpp +++ b/packing_tool/frameworks/src/json/module_json_utils.cpp @@ -112,6 +112,18 @@ bool ModuleJsonUtils::GetFaHapVerifyInfo(const std::string& hapFilePath, HapVeri hapVerifyInfo.SetProfileStr(fileContent); hapVerifyInfo.SetStageModule(false); hapVerifyInfo.SetFileLength(fileLength); + + std::string fileType = ""; + fs::path fsHapPath(hapFilePath); + std::string fileName = fsHapPath.filename().string(); + std::transform(fileName.begin(), fileName.end(), fileName.begin(), ::tolower); + if (Utils::EndsWith(fileName, HAP_SUFFIX)) { + fileType = HAP_SUFFIX; + } else if (Utils::EndsWith(fileName, HSP_SUFFIX)) { + fileType = HSP_SUFFIX; + } + hapVerifyInfo.SetFileType(fileType); + return true; } -- Gitee From 2b077828d8a18782c5a93ebd362a5c32bd4162c6 Mon Sep 17 00:00:00 2001 From: maximum2974 Date: Thu, 7 Aug 2025 19:43:28 +0800 Subject: [PATCH 2/2] fix: Out of memory bounds access Signed-off-by: maximum2974 --- packing_tool/frameworks/src/log.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packing_tool/frameworks/src/log.cpp b/packing_tool/frameworks/src/log.cpp index 61d7be6d..d2291357 100644 --- a/packing_tool/frameworks/src/log.cpp +++ b/packing_tool/frameworks/src/log.cpp @@ -34,7 +34,7 @@ const int MS_LEN = 3; void Log(char *file, char *func, int32_t line, int32_t level, char *format, ...) { - if (level < DEFAULT_LOG_LEVEL) { + if (level < DEFAULT_LOG_LEVEL || level > LOG_LEVEL::LOG_LEVEL_FATAL) { return; } auto now = std::chrono::system_clock::now(); -- Gitee