Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of array bounds in memcpy #7

Open
GoogleCodeExporter opened this issue Jul 15, 2015 · 2 comments
Open

Out of array bounds in memcpy #7

GoogleCodeExporter opened this issue Jul 15, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

In the file "math3d.h" there are two functions:
inline void m3dInjectRotationMatrix44(M3DMatrix44f dst, const M3DMatrix33f src)
inline void m3dInjectRotationMatrix44(M3DMatrix44d dst, const M3DMatrix33d src)

M3DMatrix33f and M3DMatrix33d are arrays with a size of 9:
typedef float   M3DMatrix33f[9];        // A 3 x 3 matrix, column major (floats) - 
OpenGL Style
typedef double  M3DMatrix33d[9];        // A 3 x 3 matrix, column major (doubles) - 
OpenGL Style

but inside the functions, src parameter is treated like an array of size 16:

    memcpy(dst, src, sizeof(float) * 4);
    memcpy(dst + 4, src + 4, sizeof(float) * 4);
    memcpy(dst + 8, src + 8, sizeof(float) * 4);

I think this is not correct.

Original issue reported on code.google.com by cesar.id...@gmail.com on 7 Nov 2010 at 8:43

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Patch added.

Original comment by cesar.id...@gmail.com on 8 Nov 2010 at 9:13

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant