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

Memory overrun in fortran interface returning bool #778

Closed
aaroncblack opened this issue Jun 15, 2021 · 2 comments · Fixed by #797
Closed

Memory overrun in fortran interface returning bool #778

aaroncblack opened this issue Jun 15, 2021 · 2 comments · Fixed by #797
Labels
Milestone

Comments

@aaroncblack
Copy link
Contributor

Aaron Skinner and I ran into a stack memory overflow on the Fortran interface:

conduit_node_has_path(node, path)

The C function implementation is returning a 4 byte integer, but the Fortran interface has the return type declared as a

logical(c_bool)

which is 1 byte.

So, there is a 3 byte overrun.

@aaroncblack
Copy link
Contributor Author

A couple possible fixes:

  • change the C function to use a boolean ( if requiring the c99 standard is acceptable ).
    Looks like the C function is currently upcasting the boolean coming from C++ to an integer.

  • change the Fortran interface to return a 4 byte boolean ( logical*4 ).

@cyrush
Copy link
Member

cyrush commented Jun 21, 2021

thanks @aaroncblack. To keep the current interface -- we can wrap the c funcs with a different name (we use c_ prefix for other cases) and do the conversion in a method that implements the current interface. I am sure exists in a few places, I'll do an inventory.

@cyrush cyrush added the bug label Jun 21, 2021
@cyrush cyrush added this to the 0.8.0 milestone Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants