Skip to content

Vertex duplication reads past the incidence array #103

Description

@GeneralPawz

Found by the corpus harness. Distinct from #101 (pair_up assertion)
and #102 (edge-table overrun), both now fixed: with those closed, this
is the last remaining crash across the 240-model sample.

##...[truncated]## What happens

A self-union of Thingi10K model 68933 (multi_component) aborts:

panicked at csg/boolean45.rs:12:13:
index out of bounds: the len is 394 but the index is 394

Again len == index exactly, so this is a one-past-the-end read.

Where

fn duplicate_verts(inc: &[i32], vt_r: &[i32], ps_p: &[Vec3],
                   ps_r: &mut [Vec3], vid: usize) {
    let n = inc[vid].unsigned_abs() as usize;   // <-- here

vid addresses one past the end of inc. Note this is a
different array and a different root cause from #102: that was a
count/fill mismatch building the edge table, this is a vertex
index exceeding the incidence array.

Scope

One model in 240 after #101 and #102 are fixed, so it is rarer
than either. Deliberately NOT folded into the #102 fix: widening
that change to cover an unrelated array would have made the
mutation evidence for #102 ambiguous.

Reproduce

AXIOLID_CORPUS_TRACE=1 ./target/release/axiolid-benchmarks --only=corpus 1

The trace names each model before exercising it, so the last
TRACE line before the abort identifies the input.

Not yet known

Whether vid is out of range on entry or inc is undersized at
construction. Fixing it needs that answered first -- clamping the
index would hide the cause and produce a wrong vertex set.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

needs-triageFiled but not yet accepted, sized, or scheduled

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions