vcl/source/graphic/BinaryDataContainer.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 33153adfc26e256e3cba27ae8de0ddbbd9f7ce78
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Mar 9 08:36:45 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Mar 9 11:50:42 2023 +0000

    ofz#56819 Null-dereference
    
    since:
    
    commit d062f097cc48bd53247b7fb0c677d90fcc430ab7
    Date:   Wed Mar 8 02:14:11 2023 +0300
    
        Simplify usage of BinaryDataContainer
    
        It is always used to store data read from streams
    
    Change-Id: I33d237a801b1cdf47b85b3fd3522c398ba08068b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148524
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/source/graphic/BinaryDataContainer.cxx 
b/vcl/source/graphic/BinaryDataContainer.cxx
index af6e5968911c..80e059137e63 100644
--- a/vcl/source/graphic/BinaryDataContainer.cxx
+++ b/vcl/source/graphic/BinaryDataContainer.cxx
@@ -21,9 +21,12 @@ BinaryDataContainer::BinaryDataContainer(SvStream& stream, 
size_t size)
 size_t BinaryDataContainer::calculateHash() const
 {
     size_t nSeed = 0;
-    o3tl::hash_combine(nSeed, getSize());
-    for (sal_uInt8 const& rByte : *mpData)
-        o3tl::hash_combine(nSeed, rByte);
+    if (mpData)
+    {
+        o3tl::hash_combine(nSeed, getSize());
+        for (sal_uInt8 const& rByte : *mpData)
+            o3tl::hash_combine(nSeed, rByte);
+    }
     return nSeed;
 }
 

Reply via email to