flutter_cached_network_image icon indicating copy to clipboard operation
flutter_cached_network_image copied to clipboard

On Beta Channel, Crashes with SecurityError

Open michaelheider opened this issue 1 year ago • 4 comments

🔙 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

  1. build sample app
  2. open sample app
  3. 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

michaelheider avatar Nov 04 '24 11:11 michaelheider

Now that Flutter 3.27 has hit stable as of today, this issue will be way more prevalent.

Reprevise avatar Dec 11 '24 22:12 Reprevise

Same error

hanswimtj avatar Dec 12 '24 04:12 hanswimtj

facing the same error with Flutter Channel stable, 3.27.1

mrmodh10 avatar Jan 15 '25 11:01 mrmodh10

This issue is fixed in 3.27.2 @mrmodh10

Reprevise avatar Jan 15 '25 11:01 Reprevise