Skip to content

CBL-8813: Bump fleece submodule, add DeDuplicateEncoder regression test - #2533

Merged
jianminzhao merged 1 commit into
release/4.1from
cbl-8813
Sep 2, 2026
Merged

CBL-8813: Bump fleece submodule, add DeDuplicateEncoder regression test#2533
jianminzhao merged 1 commit into
release/4.1from
cbl-8813

Conversation

@jianminzhao

Copy link
Copy Markdown
Contributor

Bumps vendor/fleece to pick up the HeapDict::_count fix (see the paired fleece PR for the root-cause writeup): a remove()-then-set() of a key that exists in a MutableDict's immutable _source left count() one too low, corrupting HeapDict::kvArray()'s cache-array sizing -- an out-of-bounds write that only fails cleanly in debug builds (HeapArray::setting()'s bounds check), silently corrupting the heap in shipping builds. Root cause of the crashes reported in CBSE-23608.

Adds a regression test exercising the actual code path that crashed in the field: DeDuplicateEncoder (used only by
VectorRecord::encodeBodyAndExtra) encoding a MutableDict in this remove-then-set state. Before the fix this doesn't fail cleanly -- it crashes the process, since HeapDict::kvArray() is reached through Dict::iterator's public constructor, itself the C-linkage function FLDictIterator_Begin(), and a C++ exception can never safely cross an extern "C" boundary. So the test asserts the correct post-fix behavior (successful encode, correct roundtrip) rather than trying to catch the crash, and is only meaningful -- and only safe to run in CI -- with the fleece fix in place.

Full CppTests suite run clean: 575 cases (572 baseline + 3 new: this one plus the two in the paired fleece PR), 35 pre-existing/unrelated failures (missing test-fixture files), zero new regressions.

Bumps vendor/fleece to pick up the HeapDict::_count fix (see the
paired fleece PR for the root-cause writeup): a remove()-then-set() of
a key that exists in a MutableDict's immutable _source left count()
one too low, corrupting HeapDict::kvArray()'s cache-array sizing --
an out-of-bounds write that only fails cleanly in debug builds
(HeapArray::setting()'s bounds check), silently corrupting the heap
in shipping builds. Root cause of the crashes reported in CBSE-23608.

Adds a regression test exercising the actual code path that crashed
in the field: DeDuplicateEncoder (used only by
VectorRecord::encodeBodyAndExtra) encoding a MutableDict in this
remove-then-set state. Before the fix this doesn't fail cleanly -- it
crashes the process, since HeapDict::kvArray() is reached through
Dict::iterator's public constructor, itself the C-linkage function
FLDictIterator_Begin(), and a C++ exception can never safely cross an
extern "C" boundary. So the test asserts the correct post-fix
behavior (successful encode, correct roundtrip) rather than trying to
catch the crash, and is only meaningful -- and only safe to run in
CI -- with the fleece fix in place.

Full CppTests suite run clean: 575 cases (572 baseline + 3 new: this
one plus the two in the paired fleece PR), 35 pre-existing/unrelated
failures (missing test-fixture files), zero new regressions.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

This is a release branch and commits are restricted.

Please confirm this PR is one of the following:

  • A response to a customer ask
  • A change per our security policy
  • A non-functional change (e.g. changes needed for building an older version)
  • A bug fix for a x.y.0 release
  • A change that has been granted an exception (please comment)

@cbl-bot

cbl-bot commented Sep 2, 2026

Copy link
Copy Markdown

Code Coverage Results:

Type Percentage
branches 64.51
functions 77.38
instantiations 71.02
lines 75.91
regions 72.08

@jianminzhao
jianminzhao merged commit d6e7cbf into release/4.1 Sep 2, 2026
10 checks passed
@jianminzhao
jianminzhao deleted the cbl-8813 branch September 2, 2026 14:18
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