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

[SWIG] Prevent irrecoverable crash when allocating arrays #2943

Open
AlbertoEAF opened this issue Mar 25, 2020 · 3 comments
Open

[SWIG] Prevent irrecoverable crash when allocating arrays #2943

AlbertoEAF opened this issue Mar 25, 2020 · 3 comments
Labels

Comments

@AlbertoEAF
Copy link
Contributor

AlbertoEAF commented Mar 25, 2020

Our Java SWIG wrappers can lead to an irrecoverable crash of the main process when allocating arrays in SWIG. This was reported in SWIG but unfortunately there was no feedback: swig/swig#1755.

Since this PR (#2859) copies that code quasi-verbatim, from carrays.i, I'll wait for it to be approved to submit changes.

There are 2 ways to fix this:

  • Easier) Use operator new (nothrow) -> return null pointer if memory allocation fails

  • Harder) Use more SWIG code to wrap the std::bad_alloc exception. -> throw OutOfMemory exception

@AlbertoEAF AlbertoEAF changed the title [SWIG] Catch std::bad_alloc with carrays.i wrappers [SWIG] Prevent irrecoverable crash when allocating arrays Mar 25, 2020
@jameslamb jameslamb added the bug label Apr 25, 2020
@guolinke
Copy link
Collaborator

guolinke commented Aug 6, 2020

@AlbertoEAF sorry for the late response.

Is this issue solved? what is your current plan to fix this?

@AlbertoEAF
Copy link
Contributor Author

AlbertoEAF commented Aug 6, 2020 via email

@guolinke
Copy link
Collaborator

guolinke commented Aug 6, 2020

@AlbertoEAF don't hurry, you can fix it anytime.

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

No branches or pull requests

3 participants