You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
alexmarkov opened this issue
Oct 11, 2018
· 0 comments
Labels
area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
BigInt is backed by TypedData (Uint32List), which is converted to ExternalTypedData when sent between isolates if it exceeds certain size (kExternalizeTypedDataThreshold in raw_object_snapshot.cc).
However, BigInt intrinsics do no account for this and handle only regular TypedData. This results in incorrect behavior of arithmetic operations after receiving such BigInt.
Test:
import'dart:io';
import'dart:isolate';
import"package:expect/expect.dart";
constint kValue =12345678;
constint kShift =8192*8;
voidverify(BigInt x) {
BigInt y = x >> kShift;
Expect.equals("$kValue", "$y");
}
voidmain() {
BigInt big =BigInt.from(kValue) << kShift;
verify(big);
final rp =newReceivePort();
rp.listen((dynamic data) {
BigInt received = data asBigInt;
verify(received);
BigInt x = received +BigInt.one -BigInt.one;
verify(x);
print("ok");
exit(0);
});
rp.sendPort.send(big);
}
This issue is somewhat similar to flutter/flutter#22796, as it is also caused by morphing TypedData to ExternalTypedData when it is sent between isolates.
The text was updated successfully, but these errors were encountered:
alexmarkov
added
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
labels
Oct 11, 2018
area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
BigInt is backed by TypedData (Uint32List), which is converted to ExternalTypedData when sent between isolates if it exceeds certain size (kExternalizeTypedDataThreshold in raw_object_snapshot.cc).
However, BigInt intrinsics do no account for this and handle only regular TypedData. This results in incorrect behavior of arithmetic operations after receiving such BigInt.
Test:
This issue is somewhat similar to flutter/flutter#22796, as it is also caused by morphing TypedData to ExternalTypedData when it is sent between isolates.
/cc @crelier @mraleph @rmacnak-google
The text was updated successfully, but these errors were encountered: