Repository navigation
Fix saveSplatToPly int32 overflow for clouds with >35M gaussians - #104
Merged
Merged
Conversation
sung-ns
requested review from
ProjitB,
azadbal and
daniel-niantic-spatial
as code owners
August 5, 2026 21:35
ProjitB
approved these changes
Aug 5, 2026
lukeyreyno
self-requested a review
August 5, 2026 21:58
lukeyreyno
approved these changes
Aug 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
saveSplatToPlystored the point count asint32_t. The total buffersize
N * D(where D = 17 + shDim*3 fields per point) overflowsINT32_MAX at around 35M gaussians with SH degree 3, causing a corrupt
allocation and a crash or silent truncation.
Changes
int32 → int64:
N,shDim,D,outIdx, and loop variablesin
saveSplatToPlyare widened toint64_t, eliminating theoverflow. The new theoretical limit (~150 quadrillion points at SH
degree 3) is not a practical concern.
Structural reorder: file open and header write moved before the
data loop, preparing for streamed output.
Chunked writing: data is written in 1M-point chunks instead of
one monolithic allocation. For a 35M-point SH degree 3 cloud this
reduces peak working buffer from ~8.7 GB to ~248 MB. The buffer is
reused across chunks, so normals (always zero) are now written
explicitly rather than relying on zero-initialisation.
Credit
Original fix is credited to Daniyar Turmukhambetov.