Skip to content

Commit 18019a6

Browse files
committed
Fixed CORE-6501: Segfault when shutting down database which got encrypted by another process
1 parent 72a0426 commit 18019a6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/jrd/CryptoManager.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,9 @@ namespace Jrd {
357357
crypt = hdr->hdr_flags & Ods::hdr_encrypted;
358358
process = hdr->hdr_flags & Ods::hdr_crypt_process;
359359

360-
if ((crypt || process) && !cryptPlugin)
360+
// tdbb w/o attachment comes when database is shutting down in the end of detachDatabase()
361+
// the only needed here page is header, i.e. we can live w/o cryptPlugin
362+
if ((crypt || process) && (!cryptPlugin) && tdbb->getAttachment())
361363
{
362364
ClumpletWriter hc(ClumpletWriter::UnTagged, hdr->hdr_page_size);
363365
hdr.getClumplets(hc);
@@ -381,7 +383,7 @@ namespace Jrd {
381383
hash = valid;
382384
}
383385

384-
if (flags & CRYPT_HDR_INIT)
386+
if (cryptPlugin && (flags & CRYPT_HDR_INIT))
385387
checkDigitalSignature(tdbb, hdr);
386388
}
387389

0 commit comments

Comments
 (0)