CppSharp icon indicating copy to clipboard operation
CppSharp copied to clipboard

Fixed memory copy error of virtual table under multiple inheritance

Open hxbb00 opened this issue 2 years ago • 7 comments

hxbb00 avatar Nov 18 '22 02:11 hxbb00

Can you add a test please?

josetr avatar Nov 18 '22 05:11 josetr

I have passed the test in the project of my company. Sorry, the project environment of my company is too big, so it is not suitable to provide the test environment. My company used this in the project, I use it in practice, so it shouldn't be a problem!

hxbb00 avatar Nov 18 '22 05:11 hxbb00

image this is mycase,here the __Internal: image

hxbb00 avatar Nov 18 '22 05:11 hxbb00

image The difference with this modification is that there is no problem when the offset is 0, but when the offset is not 0, the address is calculated incorrectly

hxbb00 avatar Nov 18 '22 05:11 hxbb00

My company used this in the project, I use it in practice, so it shouldn't be a problem!

This only tells us that it works for your specific use case and your specific platform / ABI. We have to support multiple ABI's. You may be fixing the issue in one platform and then breaking the rest.

You have made a change to this line before without a test and you are doing it again. Your previous PR shouldn't have been merged.

josetr avatar Nov 18 '22 12:11 josetr

@hxbb00 We really appreciate your contribution but as @josetr said it would be great if you could add a test.

Can you try to recreate this class hierarchy in https://github.com/mono/CppSharp/blob/main/tests/VTables/VTables.h for example?

tritao avatar Nov 18 '22 14:11 tritao

Leaving this open for now so we don't forget about it

tritao avatar Nov 23 '22 10:11 tritao