Skip to content

Incorrect return type on an @FfiNative annotation causes segfault at runtime #49471

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

Closed
dnfield opened this issue Jul 18, 2022 · 1 comment
Closed
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi vm-native

Comments

@dnfield
Copy link
Contributor

dnfield commented Jul 18, 2022

Ideally there would be analysis and even compilation issues with this:

BAD:

  @FfiNative<Handle Function(Pointer<Void>, Uint32, Uint32, Handle)>('Picture::toImageSync')
  external void _toImageSync(int width, int height, _Image outImage);

GOOD:

  @FfiNative<Void Function(Pointer<Void>, Uint32, Uint32, Handle)>('Picture::toImageSync')
  external void _toImageSync(int width, int height, _Image outImage);

Ideally the compiler or analyzer would have told me there's a mismatch between the return signature of the function and the generic parameter of the annotation. This was due to a copy paste error on my end, and resulted in a segfault at runtime that produced lots unsymbolized frames even in an unopt build.

@dcharkes maybe?

@dnfield dnfield added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-native labels Jul 18, 2022
@dcharkes
Copy link
Contributor

I recently discovered the same issue in the analzyer:

I was under the impression this was only missing in the analyzer and that the CFE did check this report compilation errors. I will double check this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi vm-native
Projects
None yet
Development

No branches or pull requests

2 participants