Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(ext/ffi): Empty buffers error with index out of bounds on FFI #14997

Merged
merged 3 commits into from
Jun 29, 2022

Conversation

aapoalas
Copy link
Collaborator

@aapoalas aapoalas commented Jun 28, 2022

Fixes #14993.

So, it turns out sometimes people create empty buffers and use them as FFI parameters. These sorts of pointers are absolutely not for writing or reading from (doing so is UB in at least C++ and LLVM), but they can serve a useful function as "end of buffer" pointers.

One way or another, these must not crash Deno.

@littledivy
Copy link
Member

@aapoalas Please rebase

@aapoalas aapoalas force-pushed the fix/ffi-ab-view-out-of-bounds branch from 5302101 to dbbd72a Compare June 29, 2022 14:12
@aapoalas
Copy link
Collaborator Author

Rebased and added the fix to the ffi_call_sync.

@littledivy littledivy merged commit 3ad8bd8 into denoland:main Jun 29, 2022
@aapoalas aapoalas deleted the fix/ffi-ab-view-out-of-bounds branch July 10, 2022 08:55
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ffi: Panic when passing empty array by value (index out of bounds)
2 participants