Skip to content

Clamp loop_start/loop_length in delPart to ensure setupPingPingLoop doesn't occasionally read/write past end of sample buffer#40

Open
prayerie wants to merge 1 commit into
NitrousTracker:newfrom
prayerie:patch-8
Open

Clamp loop_start/loop_length in delPart to ensure setupPingPingLoop doesn't occasionally read/write past end of sample buffer#40
prayerie wants to merge 1 commit into
NitrousTracker:newfrom
prayerie:patch-8

Conversation

@prayerie
Copy link
Copy Markdown

Rare edge case I found with asie's PC port and then confirmed manually in the NDS version.
Occasionally when deleting parts of audio data with a ping-pong looping sample, loop_start / loop_length can exceed the end of the sample by a couple of bytes (please do confirm in case I'm incorrect though). Adding these seemed to resolve the issue (there is still a tiny buffer overread in setupPingPongLoop, but it's unrelated and presumably benign).

@prayerie
Copy link
Copy Markdown
Author

prayerie commented Apr 20, 2026

Since opening this pull request there was somewhere else in sample.cpp that also needed these values clamping, so I'll make that change in a bit

@prayerie
Copy link
Copy Markdown
Author

Actually I tested around a bit and I must have misremembered, this is the only clamping necessary; the other thing was changing memcpy to memmove

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