mwturvey / pxl2000_Magic

9 stars 2 forks source link

Guard against array out of bounds #8

Closed xpollen8 closed 6 years ago

xpollen8 commented 6 years ago

I was observing both under and overflow of audioData array bounds, so this is more band-aid than anything.

mwturvey commented 6 years ago

I appreciate the pull request, but I kinda cringe at a band-aid because I'm afraid it will hide the issue and there will be silent failures. Instead of committing these changes, I'll make a priority on getting this bit of code solid so it will not overrun/ underrun the buffer.

xpollen8 commented 6 years ago

If it helps... Overflow situations were occurring when audioData.length is very small: 4, 8, 16.

mwturvey commented 6 years ago

Thanks, that's very helpful. I suspected that might be the case.

mwturvey commented 6 years ago

I thought I'd get to a fix sooner than I have. Accepting this pull request because it's definitely an improvement over what is there now. Thank you for posting it, and sorry about taking so long.