Skip to content

Handle empty source chunks in map! - #123

Open
quinnj wants to merge 2 commits into
mainfrom
fix/empty-chained-map-source
Open

quinnj wants to merge 2 commits into
mainfrom
fix/empty-chained-map-source

Conversation

@quinnj

@quinnj quinnj commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

Mapping from an empty ChainedVector into a nonempty destination reads a missing source chunk. Empty chunks added by append! or prepend! can cause the same invalid read: the slow path keeps the chunk count from before cleanup removed those chunks.

Return early for an empty source and refresh the source chunk count after cleanup. Regression tests cover empty sources, public empty-chunk mutations, unchanged destination tails, and callback counts. The existing length guard and matching-chunk fast path stay intact.

Validation: 84 focused checks pass on Julia 1.6.7 and 1.12.6 with bounds checks disabled; the baseline fails both reproductions with bounds checks enabled. The updated full Julia 1.12.6 suite passes 25,084,248 checks. Independent Julia 1.13 checks pass 9,430 cases for the final fix and another 9,430 with #116, including aliases and mixed chunk layouts. A warmed nonempty mapping control allocates 0 bytes. CI covers Julia 1.3 and Windows x86.

This fixes the chained-source overload; #116 handles short ordinary-vector sources.

Co-authored by Codex

@quinnj quinnj changed the title Handle empty chained sources in map! Handle empty source chunks in map! Sep 22, 2026
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.

1 participant