summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-10-12 20:59:26 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-10-13 11:02:05 +0200
commit4fed3b2ed15730fcb7a5b7e0ef09d77bd40436e6 (patch)
treee4cc8297c2711dcab952151670fe2e3c26752ecf /hwpfilter
parentec1e3c7751ae8ec8d33d536e782041b2506118d1 (diff)
ditch problematic HWPFile::Read4b variant
Change-Id: Ied3603d8f96e15013f657fc5d8150969ae3b808d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123534 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hpara.cxx2
-rw-r--r--hwpfilter/source/hpara.h2
-rw-r--r--hwpfilter/source/htags.cxx2
-rw-r--r--hwpfilter/source/hwpfile.cxx6
-rw-r--r--hwpfilter/source/hwpfile.h5
-rw-r--r--hwpfilter/source/hwpread.cxx8
6 files changed, 8 insertions, 17 deletions
diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx
index 415c8e984eb3..736188f1ad9e 100644
--- a/hwpfilter/source/hpara.cxx
+++ b/hwpfilter/source/hpara.cxx
@@ -98,7 +98,7 @@ bool HWPPara::Read(HWPFile & hwpf, unsigned char flag)
hwpf.Read2b(&nline, 1);
hwpf.Read1b(contain_cshape);
hwpf.Read1b(etcflag);
- hwpf.Read4b(&ctrlflag, 1);
+ hwpf.Read4b(ctrlflag);
hwpf.Read1b(pstyno);
/* Paragraph representative character */
diff --git a/hwpfilter/source/hpara.h b/hwpfilter/source/hpara.h
index d3b0b788970e..58694899ea38 100644
--- a/hwpfilter/source/hpara.h
+++ b/hwpfilter/source/hpara.h
@@ -104,7 +104,7 @@ class DLLEXPORT HWPPara
/**
* Checks the special characters in the paragraph
*/
- tools::ULong ctrlflag;
+ uint ctrlflag;
unsigned char pstyno;
std::shared_ptr<CharShape> cshape; /* When characters are all the same shape */
std::shared_ptr<ParaShape> pshape; /* if reuse flag is 0, */
diff --git a/hwpfilter/source/htags.cxx b/hwpfilter/source/htags.cxx
index 334e2b0f3b47..b8cafcf38675 100644
--- a/hwpfilter/source/htags.cxx
+++ b/hwpfilter/source/htags.cxx
@@ -98,7 +98,7 @@ void OlePicture::Read(HWPFile & hwpf)
return;
// We process only FILESTG_SIGNATURE_NORMAL.
- hwpf.Read4b(&signature, 1);
+ hwpf.Read4b(signature);
if (signature != FILESTG_SIGNATURE_NORMAL)
return;
#ifdef _WIN32
diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx
index 3f67111691c4..171b7e1a9e8d 100644
--- a/hwpfilter/source/hwpfile.cxx
+++ b/hwpfilter/source/hwpfile.cxx
@@ -158,12 +158,6 @@ size_t HWPFile::Read2b(void *ptr, size_t nmemb)
return hiodev ? hiodev->read2b(ptr, nmemb) : 0;
}
-void HWPFile::Read4b(void *ptr, size_t nmemb)
-{
- if (hiodev)
- hiodev->read4b(ptr, nmemb);
-}
-
size_t HWPFile::ReadBlock(void *ptr, size_t size)
{
return hiodev ? hiodev->readBlock(ptr, size) : 0;
diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h
index 9cc3b72a7c65..867a05fb7418 100644
--- a/hwpfilter/source/hwpfile.h
+++ b/hwpfilter/source/hwpfile.h
@@ -139,10 +139,7 @@ class DLLEXPORT HWPFile
* Reads nmemb short type array from HIODev
*/
size_t Read2b(void *ptr, size_t nmemb);
-/**
- * Reads nmemb long type array from HIODev
- */
- void Read4b( void *ptr, size_t nmemb );
+
/**
* Reads some bytes from HIODev not regarding endian's way
* @param size Amount for reading
diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx
index c81aaa153797..8e4a96c726d0 100644
--- a/hwpfilter/source/hwpread.cxx
+++ b/hwpfilter/source/hwpread.cxx
@@ -46,7 +46,7 @@ bool HBox::Read(HWPFile & )
bool SkipData::Read(HWPFile & hwpf)
{
uint data_block_len;
- hwpf.Read4b(&data_block_len, 1);
+ hwpf.Read4b(data_block_len);
hchar dummy;
if (!hwpf.Read2b(dummy))
@@ -73,7 +73,7 @@ bool FieldCode::Read(HWPFile & hwpf)
if (!hwpf.Read2b(dummy))
return false;
hwpf.ReadBlock(&type, 2);
- hwpf.Read4b(reserved1.data(), 1);
+ hwpf.ReadBlock(reserved1.data(), 4);
if (!hwpf.Read2b(location_info))
return false;
hwpf.ReadBlock(reserved2.data(), 22);
@@ -123,7 +123,7 @@ bool Bookmark::Read(HWPFile & hwpf)
{
uint len;
- hwpf.Read4b(&len, 1);
+ hwpf.Read4b(len);
if (!hwpf.Read2b(dummy))
return false;
@@ -402,7 +402,7 @@ bool Picture::Read(HWPFile & hwpf)
}
hwpf.AddBox(this);
- hwpf.Read4b(&follow_block_size, 1);
+ hwpf.Read4b(follow_block_size);
//when fuzzing with a max len set, max decompress to 10 times that limit
static size_t nMaxAllowedDecompression = [](const char* pEnv) { size_t nRet = pEnv ? std::atoi(pEnv) : 0; return nRet * 10; }(std::getenv("FUZZ_MAX_INPUT_LEN"));