Page MenuHomePhabricator

[native] Remove length check when unpickling
ClosedPublic

Authored by ashoat on Mar 16 2023, 12:50 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 12, 4:55 AM
Unknown Object (File)
Fri, Apr 12, 4:55 AM
Unknown Object (File)
Fri, Apr 12, 4:54 AM
Unknown Object (File)
Fri, Apr 12, 4:49 AM
Unknown Object (File)
Wed, Apr 10, 2:59 PM
Unknown Object (File)
Wed, Mar 27, 3:21 AM
Unknown Object (File)
Mar 9 2024, 3:17 PM
Unknown Object (File)
Mar 7 2024, 3:57 AM
Subscribers

Details

Summary

When we upgraded Olm versions, the length of ::olm_pickle_account_length(this->account) decreased because PICKLE_VERSION got updated. In other words, the Olm team changed the serialization format.

As a result of this, we started seeing exceptions anytime initializeCryptoAccount was called.

Looking at Olm code, the purpose of ::olm_pickle_account_length and ::olm_pickle_session_length is to figure out how much space to allocate to a buffer for pickling. It will always give you the size necessary for the most recent PICKLE_VERSION. It should not be used to compare the size in the database, since that could correspond to an old PICKLE_VERSION.

Test Plan

I was able to repro the issue, and able to confirm that this fix resolved the issue

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable