Skip to content

Avoid std::copy calls that make 0 length copy, possibly reading from an invalid pointer (UBSAN issue) - #1627

Merged
paciorek merged 3 commits into
develfrom
avoid-0-length-std-copy
Aug 18, 2026
Merged

Avoid std::copy calls that make 0 length copy, possibly reading from an invalid pointer (UBSAN issue)#1627
paciorek merged 3 commits into
develfrom
avoid-0-length-std-copy

Conversation

@perrydv

@perrydv perrydv commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

This attempts to the fix the latest CRAN UBSAN (non-)issue from code that has been working for years.

I'm having a hard time reproducing the original UBSAN issue so I haven't verified that this fixes it, but I think it should. In any case I'll run testing.

The changes are minor so there really shouldn't be a testing problem...

@perrydv

perrydv commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Three times testing failed on "Error in library(testthat) : there is no package called ‘testthat’". This seemed like a basic infrastructure issue with GitHub and/or CRAN, so I expected it to resolve itself when I restarted the test jobs, but it hasn't. @paciorek Do you have any ideas?

@perrydv

perrydv commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

Per suggestion from Claude AI, I cleared the cache. I also moved the Version and Date back to what they had been, after having modified them when trying to use R CMD check --as-cran. Tests are rerunning.

@paciorek

Copy link
Copy Markdown
Contributor

This confirms that running this branch under rhub using option 9 (clang-ubsan) resolves the issue. No error is printed when doing the dcar_proper example calculation.

@paciorek

Copy link
Copy Markdown
Contributor

@perrydv ok for me to merge this in?

@perrydv

perrydv commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

yes

@paciorek
paciorek merged commit 4b91a20 into devel Aug 18, 2026
8 checks passed
@paciorek
paciorek deleted the avoid-0-length-std-copy branch August 18, 2026 19:53
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