Fix bad pointer arithmetic in SetBufferData #33
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "TheSpydog/MoonWorks:pointerfix"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Fixes a bug where SetBufferData was writing garbage to the buffer if
startElement
was non-zero.Rather than fixing the pointer addition (it should have been
ptr + startElement
) I opted to remove it and instead pass the index explicitly when grabbing the address of the array element. I think that's a little easier to understand, and it's slightly safer too -- if you pass a startElement beyond the array bounds it will now throw an IndexOutOfRangeException instead of silently reading from outside the array bounds.