comphelper/source/misc/storagehelper.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3b6f13c2d54ddf04ad2cf4ec7c5a2e22dd623818
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Oct 15 10:38:10 2021 +0200
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Wed Oct 20 07:34:19 2021 +0200

    comphelper: fix bad error handling in CreatePackageEncryptionData()
    
    Not sure if rtl_digest_SHA1 can realistically return an error but avoid
    out-of-bounds write in this case.
    
    (regression from commit 9188ea83c346fdc2f668178ae7538665a1b09c02)
    
    Change-Id: If5f134cbcd9236338d1938242a469d7c79e87f06
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123649
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 62128c09237152d9e0585abe2fc88f0a13274b34)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123630
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit 3d8cb8264d96cb2cfcfbc0509cd3ae0318a5135d)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123778
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    Tested-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/comphelper/source/misc/storagehelper.cxx 
b/comphelper/source/misc/storagehelper.cxx
index 8308e9138514..89c284e305fb 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -430,7 +430,7 @@ uno::Sequence< beans::NamedValue > 
OStorageHelper::CreatePackageEncryptionData(
             if ( nError != rtl_Digest_E_None )
             {
                 aEncryptionData.realloc( nSha1Ind );
-                break;
+                return aEncryptionData;
             }
 
             aEncryptionData[nSha1Ind+nInd].Value <<= uno::Sequence< sal_Int8 
>( reinterpret_cast<sal_Int8*>(pBuffer), RTL_DIGEST_LENGTH_SHA1 );

Reply via email to