mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-23 03:18:59 +00:00
Always call dereference() before querying obj pointer
This commit is contained in:
parent
b5e937397c
commit
ec6719fd25
@ -326,6 +326,8 @@ QPDFObjectHandle::isBool()
|
|||||||
bool
|
bool
|
||||||
QPDFObjectHandle::isDirectNull() const
|
QPDFObjectHandle::isDirectNull() const
|
||||||
{
|
{
|
||||||
|
// Don't call dereference() -- this is a const method, and we know
|
||||||
|
// objid == 0, so there's nothing to resolve.
|
||||||
return (this->initialized && (this->objid == 0) &&
|
return (this->initialized && (this->objid == 0) &&
|
||||||
QPDFObjectTypeAccessor<QPDF_Null>::check(obj.getPointer()));
|
QPDFObjectTypeAccessor<QPDF_Null>::check(obj.getPointer()));
|
||||||
}
|
}
|
||||||
@ -2452,6 +2454,8 @@ QPDFObjectHandle::getParsedOffset()
|
|||||||
void
|
void
|
||||||
QPDFObjectHandle::setParsedOffset(qpdf_offset_t offset)
|
QPDFObjectHandle::setParsedOffset(qpdf_offset_t offset)
|
||||||
{
|
{
|
||||||
|
// This is called during parsing on newly created direct objects,
|
||||||
|
// so we can't call dereference() here.
|
||||||
if (this->obj.getPointer())
|
if (this->obj.getPointer())
|
||||||
{
|
{
|
||||||
this->obj->setParsedOffset(offset);
|
this->obj->setParsedOffset(offset);
|
||||||
@ -2694,6 +2698,8 @@ void
|
|||||||
QPDFObjectHandle::setObjectDescription(QPDF* owning_qpdf,
|
QPDFObjectHandle::setObjectDescription(QPDF* owning_qpdf,
|
||||||
std::string const& object_description)
|
std::string const& object_description)
|
||||||
{
|
{
|
||||||
|
// This is called during parsing on newly created direct objects,
|
||||||
|
// so we can't call dereference() here.
|
||||||
if (isInitialized() && this->obj.getPointer())
|
if (isInitialized() && this->obj.getPointer())
|
||||||
{
|
{
|
||||||
this->obj->setDescription(owning_qpdf, object_description);
|
this->obj->setDescription(owning_qpdf, object_description);
|
||||||
@ -2703,10 +2709,14 @@ QPDFObjectHandle::setObjectDescription(QPDF* owning_qpdf,
|
|||||||
bool
|
bool
|
||||||
QPDFObjectHandle::hasObjectDescription()
|
QPDFObjectHandle::hasObjectDescription()
|
||||||
{
|
{
|
||||||
if (isInitialized() && this->obj.getPointer())
|
if (isInitialized())
|
||||||
|
{
|
||||||
|
dereference();
|
||||||
|
if (this->obj.getPointer())
|
||||||
{
|
{
|
||||||
return this->obj->hasDescription();
|
return this->obj->hasDescription();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user