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

[vm/ffi] Wrong error message for Array boundaries check #45189

Closed
sgrekhov opened this issue Mar 4, 2021 · 0 comments
Closed

[vm/ffi] Wrong error message for Array boundaries check #45189

sgrekhov opened this issue Mar 4, 2021 · 0 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi P2 A bug or feature request we're likely to work on

Comments

@sgrekhov
Copy link
Contributor

sgrekhov commented Mar 4, 2021

import "dart:ffi";

class Struct8BytesInlineArrayInt extends Struct {
  @Array(8)
  external Array<Uint8> a0;
}

void main() {
  final pointer = calloc<Struct8BytesInlineArrayInt>();
  final array = pointer.ref.a0;
  array[8]; // RangeError: Invalid value: Not in inclusive range 0..8: 8
}

Error message here is wrong. Valid range here is 0..7

Dart SDK version: 2.13.0-edge.dcd57353459f85beb7bbe415a452c54fd6e9833a (be) (Tue Mar 2 00:10:50 2021 +0000) on "windows_x64"

@sgrekhov sgrekhov added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi labels Mar 4, 2021
@dcharkes dcharkes added this to the March Beta Release milestone Mar 29, 2021
@franklinyow franklinyow added the P2 A bug or feature request we're likely to work on label Mar 29, 2021
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 P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

3 participants