Skip to content

Use size_t for View indices to prevent potential integer overflow#75

Merged
keichi merged 1 commit intomasterfrom
fix-int-overflow-indices
Jan 6, 2026
Merged

Use size_t for View indices to prevent potential integer overflow#75
keichi merged 1 commit intomasterfrom
fix-int-overflow-indices

Conversation

@keichi
Copy link
Copy Markdown
Owner

@keichi keichi commented Jan 6, 2026

Summary

  • Change loop indices from int to size_t when accessing 2D Views in stats.cpp and io.cpp
  • Prevents potential integer overflow when the total number of elements exceeds INT_MAX

Changes

  • stats.cpp: Use size_t for indices i and j in corrcoef(CrossMap, Dataset, TimeSeries)
  • io.cpp: Use size_t for n_rows, n_columns, and loop indices in load_csv()

Test plan

  • C++ tests pass

keichi pushed a commit that referenced this pull request Jan 6, 2026
Resolved merge conflict by combining both changes:
- PR #75: Changed loop indices from int to size_t to prevent overflow
- PR #74: Kept CorrcoefSimpleState and Kokkos::min for performance
@keichi keichi force-pushed the fix-int-overflow-indices branch from 8be4de9 to 33695a0 Compare January 6, 2026 14:51
Change loop indices from int to size_t when accessing 2D Views in
stats.cpp and io.cpp to prevent potential integer overflow when the
total number of elements exceeds INT_MAX.
@keichi keichi force-pushed the fix-int-overflow-indices branch from 33695a0 to e6135d1 Compare January 6, 2026 14:56
@keichi keichi merged commit 2ffcf12 into master Jan 6, 2026
10 checks passed
@keichi keichi deleted the fix-int-overflow-indices branch January 6, 2026 15:03
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