Prevent JNI Variant conversion stack overflow#110452
Prevent JNI Variant conversion stack overflow#110452Repiteo merged 1 commit intogodotengine:masterfrom
Conversation
6ed12c7 to
da1b8e2
Compare
m4gr3d
left a comment
There was a problem hiding this comment.
Looks good, thanks for the fix!
|
@limbonaut Could you use https://github.com/dsnopek/javaclasswrapper-test to validate that the fix doesn't introduce a regression. @dsnopek @syntaxerror247 We should look into whether we can integrated the |
da1b8e2 to
476b901
Compare
|
I ran the tests, and they all passed! But I’ve added an extra test to check if variant conversion is safe from stack overflow, and it still crashed. I’m updating the PR because there was an issue in my implementation, leaving jvalue uninitialized and still leading to crash. Thanks for pointing me towards those tests, @m4gr3d! I’ll also make a PR for the test repo to add the SO test. Now, all the tests are passing, including the new one for stack overflow: |
|
Thanks! |

While I was testing a plugin with Godot on Android, I triggered a stack overflow by trying to convert a Variant with cyclic references. This PR prevents crashes by adding a call depth guard, similar to how it's handled in other places in the codebase.