mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +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();
|
QPDFObjectHandle trailer = pdf.getTrailer();
|
||||||
if (trailer.hasKey("/Info"))
|
if (trailer.hasKey("/Info"))
|
||||||
{
|
{
|
||||||
QPDFObjectHandle info = trailer.getKey("/Info");
|
for (auto& it: QPDFDictItems(trailer.getKey("/Info")))
|
||||||
for (auto& it: QPDFDictItems(info))
|
|
||||||
{
|
{
|
||||||
std::string val;
|
std::string val;
|
||||||
if (it.second.isString())
|
if (it.second.isString())
|
||||||
|
@ -1242,7 +1242,7 @@ class QPDFDictItems
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
QPDFDictItems(QPDFObjectHandle& oh);
|
QPDFDictItems(QPDFObjectHandle const& oh);
|
||||||
|
|
||||||
class iterator: public std::iterator<
|
class iterator: public std::iterator<
|
||||||
std::bidirectional_iterator_tag,
|
std::bidirectional_iterator_tag,
|
||||||
@ -1314,7 +1314,7 @@ class QPDFDictItems
|
|||||||
iterator end();
|
iterator end();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPDFObjectHandle& oh;
|
QPDFObjectHandle oh;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QPDFArrayItems
|
class QPDFArrayItems
|
||||||
@ -1332,7 +1332,7 @@ class QPDFArrayItems
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
QPDFArrayItems(QPDFObjectHandle& oh);
|
QPDFArrayItems(QPDFObjectHandle const& oh);
|
||||||
|
|
||||||
class iterator: public std::iterator<
|
class iterator: public std::iterator<
|
||||||
std::bidirectional_iterator_tag,
|
std::bidirectional_iterator_tag,
|
||||||
@ -1403,7 +1403,7 @@ class QPDFArrayItems
|
|||||||
iterator end();
|
iterator end();
|
||||||
|
|
||||||
private:
|
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)
|
oh(oh)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -3171,7 +3171,7 @@ QPDFDictItems::end()
|
|||||||
return iterator(oh, false);
|
return iterator(oh, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPDFArrayItems::QPDFArrayItems(QPDFObjectHandle& oh) :
|
QPDFArrayItems::QPDFArrayItems(QPDFObjectHandle const& oh) :
|
||||||
oh(oh)
|
oh(oh)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user