Registry icon indicating copy to clipboard operation
Registry copied to clipboard

The library doesn't extend the hive size when applying transaction log entries

Open msuhanov opened this issue 2 years ago • 2 comments

Hello.

The error message is: RE-1

The problem is here: https://github.com/EricZimmerman/Registry/blob/2c8b9a47e58f6046ef3060b7f1735f9d2ac8327e/Registry/TransactionLog.cs#L211

The problem is that the library doesn't support the extension of the hive file size, so an attempt to write beyond the current end of the hive file results in the exception shown above.

To resolve the issue, you need to read the "Hive bins data size" field of the log entry being applied and extend the hiveBytes length accordingly.

msuhanov avatar Dec 29 '23 11:12 msuhanov

so if i am understanding this correctly, the dirty pages in the hive do not simply overwrite other pages in the main hive, but can EXPAND them?

so this becomes not a buffer copy per se, but potentially increasing the size of the data being written into the middle of the hive?

its not just a matter of adding extra data to the end of hiveBytes tho, as all the data would have to be moved when inserting the dirty page?

Its not clear if hiveBytes just needs made bigger and the pages still get overwritten as is. that is certainly a bit easier to do, but seems like other data has the possibility to be overwritten.

do you happen to have the GrownHive test file in your yarp repo? i didnt see it

EricZimmerman avatar Jan 24 '24 16:01 EricZimmerman