Skip to content

Migrate raw pointers to unique_ptr and fix memory/stability issues#38

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

Migrate raw pointers to unique_ptr and fix memory/stability issues#38
crayy8 wants to merge 2 commits intoSleuthKitLabs:develop-4.14from
crayy8:rejistry_updates

Conversation

@crayy8
Copy link
Member

@crayy8 crayy8 commented Mar 24, 2026

  • Replace raw pointer ownership with unique_ptr throughout the library: RegistryByteBuffer, ValueData, RegistryKey, RegistryValue, RegistryHiveFile, RegistryHiveBuffer, Cell, HBIN, REGFHeader, NKRecord, VKRecord, ValueListRecord
  • Remove AutoCellPtrList and AutoHBINPtrList RAII wrappers now that unique_ptr handles lifetime automatically
  • Add virtual destructor to BinaryBlock to prevent UB when deleting through base class pointer
  • Fix integer overflow in ByteBuffer::read() bounds check via uint64_t cast
  • Fix dangling pointer in RejistryException::what() by caching result in mutable member
  • Fix RegistryHiveFile::getErrorMessage() to handle FormatMessageA failure
  • Fix REGFHeader::getHBINs() to std::move unique_ptr into vector
  • Refactor Rejistry test program to exercise both RegistryHiveFile and RegistryHiveBuffer through shared processRegistryHive() function

- Replace raw pointer ownership with unique_ptr throughout the library:
  RegistryByteBuffer, ValueData, RegistryKey, RegistryValue,
  RegistryHiveFile, RegistryHiveBuffer, Cell, HBIN, REGFHeader,
  NKRecord, VKRecord, ValueListRecord
- Remove AutoCellPtrList and AutoHBINPtrList RAII wrappers now that
  unique_ptr handles lifetime automatically
- Add virtual destructor to BinaryBlock to prevent UB when deleting
  through base class pointer
- Fix integer overflow in ByteBuffer::read() bounds check via uint64_t cast
- Fix dangling pointer in RejistryException::what() by caching result
  in mutable member
- Fix RegistryHiveFile::getErrorMessage() to handle FormatMessageA failure
- Fix REGFHeader::getHBINs() to std::move unique_ptr into vector
- Refactor Rejistry test program to exercise both RegistryHiveFile and
  RegistryHiveBuffer through shared processRegistryHive() function
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