diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-08-30 16:35:36 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-08-31 14:44:34 +0200 |
commit | 2053a545413e788f6d3fb74e0335f8f2d354a0cc (patch) | |
tree | fbe8be667b03ffb050c82c5c1fed92458cf1289f /sw | |
parent | 21dbf18064480cade972f50431a7fad6505d6d43 (diff) |
ofz: MemorySanitizer: use-of-uninitialized-value
no idea why its like this in the first place, but I'm not
going to change it decades later, just zero out the uninit
bytes
Change-Id: Ie5d875523999d465dc167ac4fedcb99d3825ae99
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121363
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/ww8/ww8scan.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index b79881604a8d..cf81cc434560 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -2313,8 +2313,15 @@ void WW8PLCF::ReadPLCF(SvStream& rSt, WW8_FC nFilePos, sal_uInt32 nPLCF) if (bValid) { // Pointer to Pos-array - pPLCF_PosArray.reset( new WW8_CP[ ( nPLCF + 3 ) / 4 ] ); + const size_t nEntries = (nPLCF + 3) / 4; + pPLCF_PosArray.reset(new WW8_CP[nEntries]); bValid = checkRead(rSt, pPLCF_PosArray.get(), nPLCF); + size_t nBytesAllocated = nEntries * sizeof(WW8_CP); + if (bValid && nPLCF != nBytesAllocated) + { + sal_uInt8* pStartBlock = reinterpret_cast<sal_uInt8*>(pPLCF_PosArray.get()); + memset(pStartBlock + nPLCF, 0, nBytesAllocated - nPLCF); + } } if (bValid) |