Skip to content

Fix some vertex index overflow issues in geometry builders#942

Merged
nical merged 2 commits intonical:mainfrom
moulins:geom-builder-vertex-offset-overflow
Mar 8, 2026
Merged

Fix some vertex index overflow issues in geometry builders#942
nical merged 2 commits intonical:mainfrom
moulins:geom-builder-vertex-offset-overflow

Conversation

@moulins
Copy link
Contributor

@moulins moulins commented Feb 22, 2026

  • Make sure that using BuffersBuilder::with_vertex_offset with large values cannot overflow OutputVertex indices.
  • Fix MaxIndex bounds for u32, u64, i64, usize, isize: VertexId::INVALID wasn't properly excluded, and isize had the entirely wrong value on 32-bit targets.

See the newly-added `overflow_with_vertex_offset` test.
- `u32::MAX` shouldn't be a valid output vertex index (it's `VertexId::INVALID`);
- `<isize as MaxIndex>::MAX` had the wrong value on 32 bit targets.
Copy link
Owner

@nical nical left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Sorry for the delay.

@nical nical merged commit 4e7e8c6 into nical:main Mar 8, 2026
3 checks passed
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.

2 participants