summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hwpfilter/source/hpara.cxx3
-rw-r--r--hwpfilter/source/hwpfile.cxx1
-rw-r--r--hwpfilter/source/hwpfile.h21
3 files changed, 25 insertions, 0 deletions
diff --git a/hwpfilter/source/hpara.cxx b/hwpfilter/source/hpara.cxx
index 7739b9cd0a85..79fd93145ad8 100644
--- a/hwpfilter/source/hpara.cxx
+++ b/hwpfilter/source/hpara.cxx
@@ -87,6 +87,9 @@ HWPPara::~HWPPara()
bool HWPPara::Read(HWPFile & hwpf, unsigned char flag)
{
+ DepthGuard aGuard(hwpf);
+ if (aGuard.toodeep())
+ return false;
int ii;
scflag = flag;
// Paragraph Information
diff --git a/hwpfilter/source/hwpfile.cxx b/hwpfilter/source/hwpfile.cxx
index 69653f162f6d..128be0caa7af 100644
--- a/hwpfilter/source/hwpfile.cxx
+++ b/hwpfilter/source/hwpfile.cxx
@@ -50,6 +50,7 @@ HWPFile::HWPFile()
, info_block_len(0)
, error_code(HWP_NoError)
, oledata(nullptr)
+ , readdepth(0)
, m_nCurrentPage(1)
, m_nMaxSettedPage(0)
, hiodev(nullptr)
diff --git a/hwpfilter/source/hwpfile.h b/hwpfilter/source/hwpfile.h
index 83bf28860f9b..470fa2bdfd41 100644
--- a/hwpfilter/source/hwpfile.h
+++ b/hwpfilter/source/hwpfile.h
@@ -275,6 +275,7 @@ class DLLEXPORT HWPFile
int error_code;
OlePicture *oledata;
unsigned char scratch[SAL_MAX_UINT16];
+ int readdepth;
private:
/* hwp 파일 이름 */
@@ -310,6 +311,26 @@ class DLLEXPORT HWPFile
friend HWPFile *SetCurrentDoc(HWPFile *);
};
+class DLLEXPORT DepthGuard
+{
+private:
+ HWPFile& m_rFile;
+public:
+ DepthGuard(HWPFile &rFile)
+ : m_rFile(rFile)
+ {
+ ++m_rFile.readdepth;
+ }
+ bool toodeep() const
+ {
+ return m_rFile.readdepth == 1024;
+ }
+ ~DepthGuard()
+ {
+ --m_rFile.readdepth;
+ }
+};
+
HWPFile *GetCurrentDoc(void);
HWPFile *SetCurrentDoc(HWPFile *hwpfp);
#endif // INCLUDED_HWPFILTER_SOURCE_HWPFILE_H