mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Improve memory safety of dict/array iterators
This commit is contained in:
parent
1fec40454e
commit
4ae93a73c5
@ -39,8 +39,7 @@ void dumpInfoDict(QPDF& pdf,
|
||||
QPDFObjectHandle trailer = pdf.getTrailer();
|
||||
if (trailer.hasKey("/Info"))
|
||||
{
|
||||
QPDFObjectHandle info = trailer.getKey("/Info");
|
||||
for (auto& it: QPDFDictItems(info))
|
||||
for (auto& it: QPDFDictItems(trailer.getKey("/Info")))
|
||||
{
|
||||
std::string val;
|
||||
if (it.second.isString())
|
||||
|
@ -1242,7 +1242,7 @@ class QPDFDictItems
|
||||
|
||||
public:
|
||||
QPDF_DLL
|
||||
QPDFDictItems(QPDFObjectHandle& oh);
|
||||
QPDFDictItems(QPDFObjectHandle const& oh);
|
||||
|
||||
class iterator: public std::iterator<
|
||||
std::bidirectional_iterator_tag,
|
||||
@ -1314,7 +1314,7 @@ class QPDFDictItems
|
||||
iterator end();
|
||||
|
||||
private:
|
||||
QPDFObjectHandle& oh;
|
||||
QPDFObjectHandle oh;
|
||||
};
|
||||
|
||||
class QPDFArrayItems
|
||||
@ -1332,7 +1332,7 @@ class QPDFArrayItems
|
||||
|
||||
public:
|
||||
QPDF_DLL
|
||||
QPDFArrayItems(QPDFObjectHandle& oh);
|
||||
QPDFArrayItems(QPDFObjectHandle const& oh);
|
||||
|
||||
class iterator: public std::iterator<
|
||||
std::bidirectional_iterator_tag,
|
||||
@ -1403,7 +1403,7 @@ class QPDFArrayItems
|
||||
iterator end();
|
||||
|
||||
private:
|
||||
QPDFObjectHandle& oh;
|
||||
QPDFObjectHandle oh;
|
||||
};
|
||||
|
||||
|
||||
|
@ -3080,7 +3080,7 @@ QPDFObjectHandle::warn(QPDF* qpdf, QPDFExc const& e)
|
||||
}
|
||||
}
|
||||
|
||||
QPDFDictItems::QPDFDictItems(QPDFObjectHandle& oh) :
|
||||
QPDFDictItems::QPDFDictItems(QPDFObjectHandle const& oh) :
|
||||
oh(oh)
|
||||
{
|
||||
}
|
||||
@ -3171,7 +3171,7 @@ QPDFDictItems::end()
|
||||
return iterator(oh, false);
|
||||
}
|
||||
|
||||
QPDFArrayItems::QPDFArrayItems(QPDFObjectHandle& oh) :
|
||||
QPDFArrayItems::QPDFArrayItems(QPDFObjectHandle const& oh) :
|
||||
oh(oh)
|
||||
{
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user