From 8647293f0a3b84bbd5415422ead90370cb07c7db Mon Sep 17 00:00:00 2001 From: wanghao-free Date: Thu, 14 Apr 2022 01:08:07 -0700 Subject: [PATCH] =?UTF-8?q?fix:=20lts3.0=E5=88=86=E6=94=AF=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9pkg=5Fupgradefile.cpp=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88=E5=8F=82=E6=95=B0=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E5=AF=BC=E8=87=B4=E5=86=85=E5=AD=98=E9=9D=9E=E6=B3=95?= =?UTF-8?q?=E8=AE=BF=E9=97=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit master主干已经解决,同步到lts3.0分支 Signed-off-by: wanghao-free --- services/package/pkg_package/pkg_upgradefile.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/package/pkg_package/pkg_upgradefile.cpp b/services/package/pkg_package/pkg_upgradefile.cpp index 8ca02378..752ab2f1 100644 --- a/services/package/pkg_package/pkg_upgradefile.cpp +++ b/services/package/pkg_package/pkg_upgradefile.cpp @@ -325,6 +325,11 @@ int32_t UpgradePkgFile::ReadUpgradePkgHeader(const PkgBuffer &buffer, size_t &re PkgFile::ConvertBufferToString(pkgInfo_.productUpdateId, {header->productUpdateId, sizeof(header->productUpdateId)}); + algorithm = PkgAlgorithmFactory::GetDigestAlgorithm(pkgInfo_.pkgInfo.digestMethod); + PKG_CHECK(algorithm != nullptr, return PKG_NOT_EXIST_ALGORITHM, + "Invalid file %s", pkgStream_->GetFileName().c_str()); + algorithm->Init(); + if (currLen + tlv.length >= readLen) { // Extra TLV information, read it. realLen = currLen + tlv.length; algorithm->Update(buffer, realLen); @@ -347,10 +352,6 @@ int32_t UpgradePkgFile::ReadUpgradePkgHeader(const PkgBuffer &buffer, size_t &re realLen += currLen; // Parser header to get compressional algorithm - algorithm = PkgAlgorithmFactory::GetDigestAlgorithm(pkgInfo_.pkgInfo.digestMethod); - PKG_CHECK(algorithm != nullptr, return PKG_NOT_EXIST_ALGORITHM, - "Invalid file %s", pkgStream_->GetFileName().c_str()); - algorithm->Init(); algorithm->Update(buffer, currLen); // Generate digest return PKG_SUCCESS; } -- Gitee