-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
UPBGE: Fix for issue #797 #869
Conversation
@@ -1297,7 +1297,13 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const GPUType | |||
input->type = type; | |||
input->source = GPU_SOURCE_VEC_UNIFORM; | |||
|
|||
memcpy(input->vec, link->ptr1, type * sizeof(float)); | |||
if (type == GPU_INT) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@panzergame We can even make this GPU_INT check only and left all above changes as they are in current master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about using an array for size of types indexed by GPUType ? So you can change the values and avoid exceptions in the code when adding conditions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced to do that before final release. I would prefer fix memcpy and make the tiny refactor after
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you want, but the refactor is just defining an array of 18 elements.
eb06a57
to
637bee8
Compare
@@ -55,6 +55,11 @@ | |||
#include <string.h> | |||
#include <stdarg.h> | |||
|
|||
#ifndef ARRAYSIZE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to include BLI_utildefines.h
for this macro ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just squash and make a commit message, then push on master. Thank you for the patch.
Introduce a new array of GPUType sizes to avoid a buffer overrun. The new array will allow make the system extensible easier. More comments added. P.D. It fixes the win32 crash
e46fe8f
to
d438f1c
Compare
Set GPU_INT to 5 avoid buffer overrun
This is due to the following:
in gpu_codegen.c in gpu_node_input_link we have the following catch all
and in the typedef for GPUInput we have this for vec
As the type for INT was 17, this will copy 17 floats from link->ptr1 overwriting input->link with garbage.