On Beta Channel, Crashes with SecurityError
🔙 Regression
On Flutter beta channel, the below crashes the application. The stable branch is fine.
Possibly related to this issue with Flutter's Image.network widget.
Old (and correct) behavior
Show the image.
Current behavior
App crashes.
Reproduction steps
- build sample app
- open sample app
- monitor browser console for crash logs
`main.dart`
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/widgets.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return CachedNetworkImage(
imageUrl:
'https://fastly.picsum.photos/id/505/40/40.jpg?hmac=egB4BZLkmlPCkk32_xTVvQg2I8QZH2w369evjD3Q1Pk',
);
}
}
Logs
First, a whole bunch of these:
main.dart.js:3193 Uncaught Error: SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The image element contains cross-origin data, and may not be loaded.
Then, a whole bunch of these:
main.dart.js:3193 Uncaught Error: RuntimeError: memory access out of bounds
at canvaskit.wasm:0xd89f
at canvaskit.wasm:0x83f5
at canvaskit.wasm:0x44a9e5
at canvaskit.wasm:0x723cd
at Tb.<anonymous> (canvaskit.js:116:52)
at Tb.<anonymous> (canvaskit.js:156:256)
at new PictureRecorder (canvaskit.js:105:189)
at cS.iG (main.dart.js:11501:13)
at xJ.$0 (main.dart.js:11178:7)
at Object.Oa (main.dart.js:1109:17)
The complete stack traces are very long and unreadable. See an export here: browser-console.log
Depending on the surrounding app, the errors are also different, but go into a similar direction.
Uncaught : Null check operator used on a null value in here browser-console_2.log.
I have also seen something along the lines of (reciting from memory) Function Argument Missmatch Error, but cannot reproduce that case at the moment.
Configuration
- Flutter version: Channel beta, 3.27.0-0.1.pre
- cached_network_image Version: 3.4.1
- Platform: web
Now that Flutter 3.27 has hit stable as of today, this issue will be way more prevalent.
Same error
facing the same error with Flutter Channel stable, 3.27.1
This issue is fixed in 3.27.2 @mrmodh10