<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Implement digital signature support (qt frontends)"
href="https://bugs.freedesktop.org/show_bug.cgi?id=94378#c14">Comment # 14</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Implement digital signature support (qt frontends)"
href="https://bugs.freedesktop.org/show_bug.cgi?id=94378">bug 94378</a>
from <span class="vcard"><a class="email" href="mailto:aacid@kde.org" title="Albert Astals Cid <aacid@kde.org>"> <span class="fn">Albert Astals Cid</span></a>
</span></b>
<pre>You need to implemement the copy/assignment operators of
SignatureValidationInfo or make it not copiable/assignable, otherwise bad stuff
happens since the default implementations just do a = on the d_ptr, so when you
destroy it, there's a double delete on the d_ptr.
As proof, just add
Poppler::SignatureValidationInfo svi2 = svi;
in poppler-forms.cpp after the svi assignment and then running it with valgrind
(on a file that actually has signatures) and you'll get stuff like
==4234== Invalid read of size 8
==4234== at 0x4E85599: load (atomic_base.h:396)
==4234== by 0x4E85599: load<int> (qatomic_cxx11.h:96)
==4234== by 0x4E85599: load (qbasicatomic.h:116)
==4234== by 0x4E85599: deref (qrefcount.h:60)
==4234== by 0x4E85599: ~QString (qstring.h:1065)
==4234== by 0x4E85599: ~SignatureValidationInfoPrivate (poppler-form.cc:420)
==4234== by 0x4E85599:
Poppler::SignatureValidationInfo::~SignatureValidationInfo()
(poppler-form.cc:436)
==4234== by 0x10B18D: main (poppler-forms.cpp:189)
==4234== Address 0xf053f88 is 8 bytes inside a block of size 24 free'd
==4234== at 0x4C2E26B: operator delete(void*) (vg_replace_malloc.c:576)
==4234== by 0x10B185: main (poppler-forms.cpp:190)
==4234== Block was alloc'd at
==4234== at 0x4C2D1AF: operator new(unsigned long) (vg_replace_malloc.c:334)
==4234== by 0x4E856F2:
Poppler::FormFieldSignature::validate(Poppler::FormFieldSignature::ValidateOptions)
const (poppler-form.cc:483)
==4234== by 0x10AF29: main (poppler-forms.cpp:189)
==4234==
==4234== Invalid free() / delete / delete[] / realloc()
==4234== at 0x4C2E26B: operator delete(void*) (vg_replace_malloc.c:576)
==4234== by 0x10B18D: main (poppler-forms.cpp:189)
==4234== Address 0xf053f80 is 0 bytes inside a block of size 24 free'd
==4234== at 0x4C2E26B: operator delete(void*) (vg_replace_malloc.c:576)
==4234== by 0x10B185: main (poppler-forms.cpp:190)
==4234== Block was alloc'd at
==4234== at 0x4C2D1AF: operator new(unsigned long) (vg_replace_malloc.c:334)
==4234== by 0x4E856F2:
Poppler::FormFieldSignature::validate(Poppler::FormFieldSignature::ValidateOptions)
const (poppler-form.cc:483)
==4234== by 0x10AF29: main (poppler-forms.cpp:189)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>