Skip to content

CBL-7866: Exception when decode a cbllog binary file#2447

Open
jianminzhao wants to merge 1 commit intomasterfrom
cbl-7866
Open

CBL-7866: Exception when decode a cbllog binary file#2447
jianminzhao wants to merge 1 commit intomasterfrom
cbl-7866

Conversation

@jianminzhao
Copy link
Contributor

The symptom points to possiblity that string contains '\0' in the content. This caused that we write bytes after 0, which the decoder thinks it ends a string, and leaving some bytes unconsumed. We fix it by getting c_str() from a string before we write the string, truncating all bytes after 0.

The symptom points to possiblity that string contains '\0' in the content. This caused that we write bytes after 0, which the decoder thinks it ends a string, and leaving some bytes unconsumed.
We fix it by getting c_str() from a string before we write the string, truncating all bytes after 0.
@cbl-bot
Copy link

cbl-bot commented Mar 13, 2026

Code Coverage Results:

Type Percentage
branches 64.65
functions 77.35
instantiations 70.96
lines 75.95
regions 72.2

@snej
Copy link
Collaborator

snej commented Mar 13, 2026

It should throw an exception instead of truncating the string. We need to find out how this could happen and fix that.

@jianminzhao
Copy link
Contributor Author

If we throw, where to catch it? Do we close the encoder and roll to a new encoder? Usually, it happens in customer field, how would it get our attention?

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.

3 participants