Skip to content

Rejistry updates#37

Open
crayy8 wants to merge 9 commits intoSleuthKitLabs:develop-4.14from
crayy8:rejistry_updates
Open

Rejistry updates#37
crayy8 wants to merge 9 commits intoSleuthKitLabs:develop-4.14from
crayy8:rejistry_updates

Conversation

@crayy8
Copy link
Member

@crayy8 crayy8 commented Mar 15, 2026

No description provided.

bcarrier and others added 7 commits March 2, 2026 10:54
Replace raw pointer typedefs with std::unique_ptr for SubkeyListRecord,
ValueListRecord, DBRecord, and DBIndirectRecord. All Cell factory methods
now use make_unique. Callers no longer manually delete these returned
records. Also fixes a logic bug in NKRecord::getSubkeyList() where the
early-return for empty subkey count was missing the return keyword,
causing fall-through to an invalid offset read. Initialize previously
uninitialized member variables in BinaryBlock, Buffer, and
DirectSubkeyListRecord. Remove orphaned LIRecordPtr typedef from LIRecord.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c->getSubkeyList() returns unique_ptr by value (already an rvalue),
so std::move is a no-op. Also remove now-unused <utility> include.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Clarify which methods return unique_ptr (no caller cleanup needed)
vs raw pointers where the caller is responsible for freeing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Consistent with prior member initialization fixes across the library.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@crayy8
Copy link
Member Author

crayy8 commented Mar 16, 2026

This PR is to take in changes from sleuthkit#3447 and address comments and fix other memory leaks.

@crayy8
Copy link
Member Author

crayy8 commented Mar 16, 2026

I am generally good with this PR but we should have Ann review and I'd like to do some comparisons on registry output before and after before we merge this.

@crayy8 crayy8 closed this Mar 16, 2026
@crayy8 crayy8 reopened this Mar 16, 2026
@crayy8 crayy8 requested a review from APriestman March 16, 2026 02:27
crayy8 and others added 2 commits March 18, 2026 00:02
Forensic data may not be properly null-terminated. After parsing
null-delimited strings, capture any trailing data that lacks a
double-null terminator by padding for wchar_t alignment and
appending a null terminator before constructing the wstring.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The offset parameter now correctly refers to the destination buffer
offset rather than the source buffer offset, matching the original
Java ByteBuffer.get(byte[], int, int) contract. Fixed validation
checks and memcpy accordingly.

memcpy(&dst[0], &_buffer[_position + offset], length);
_position += offset;
memcpy(&dst[offset], &_buffer[_position], length);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: none of this really matters in our current code as this method is only called in one location RegistryByteBuffer::getData. This method doesn't use it as intended as it always passes in an offset of 0 and saved the current buffer position before calling and restores it after calling so this logic does not even come into play in our usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants