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

[BUG] Range Error When Building With MSIX #575

Closed
jlambright opened this issue Sep 25, 2023 · 10 comments
Closed

[BUG] Range Error When Building With MSIX #575

jlambright opened this issue Sep 25, 2023 · 10 comments

Comments

@jlambright
Copy link

|Unhandled exception: RangeError (index): Index out of range: index should be less than 7744: 7748 #0 Uint8List.[]= (dart:typed_data-patch/typed_data_patch.dart:22[80](https://gitlab.corp.dataspeedinc.com/kinetic/360/dsk360_command/-/jobs/5509#L80):7) #1 ImageDataUint8.setPixelRgba (package:image/src/image/image_data_uint8.dart:111:9) #2 Image.setPixel (package:image/src/image/image.dart:761:11) #3 copyResize (package:image/src/transform/copy_resize.dart:132:15) #4 Assets.createIcons.generateIcon (package:msix/src/assets.dart:66:26) #5 Assets.createIcons.<anonymous closure> (package:msix/src/assets.dart:139:13) #6 _RemoteRunner._run (dart:isolate:1021:47) #7 _RemoteRunner._remoteExecute (dart:isolate:1015:12) #8 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:17) #9 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:1[89](https://gitlab.corp.dataspeedinc.com/kinetic/360/dsk360_command/-/jobs/5509#L89):12)

I can't seem to pinpoint when these two packages stopped working together, but it's semi-recently. I've rolled each package (individually) to the point where they last produced a good build. When both are rolled back, it works. Which means something changed in how they interact with each other.

MSIX
Maintainer: @YehudaKremer

@brendan-duncan
Copy link
Owner

I have never used MSIX (and don't have any time to start using it) so I can't test the problem/fix. But the error says to me copyResize needs to do a better job range checking/clamping, which I can add. I don't know what parameters MSIX is calling copyResize with, to know why it's getting out of bounds, and I don't know if that's because of a problem on their side or mine. But at least adding improved checking to copyResize should resolve that particular RangeError.

@jlambright
Copy link
Author

I've been doing some more digging. When I fed it a webp file I got a completely different error:

building msix files...                  �/Unhandled exception:
Error reading logo file: assets/images/ds_minimalist_logo.webp
#0      Assets.createIcons (package:msix/src/assets.dart:39:9)
<asynchronous suspension>
#1      Msix._buildMsixFiles (package:msix/msix.dart:114:5)
<asynchronous suspension>
#2      Msix._createMsix (package:msix/msix.dart:102:5)
<asynchronous suspension>
#3      Msix.create (package:msix/msix.dart:59:5)
<asynchronous suspension>
#4      main (file:///C:/Users/user/AppData/Local/Pub/Cache/hosted/pub.dev/msix-3.16.2/bin/create.dart:4:3)
<asynchronous suspension>

And here is a png:

RangeError (index): Index out of range: index should be less than 7920: 8144
#0      Uint8List.[]= (dart:typed_data-patch/typed_data_patch.dart:2280:7)
#1      ImageDataUint8.setPixelRgba (package:image/src/image/image_data_uint8.dart:111:9)
#2      Image.setPixel (package:image/src/image/image.dart:761:11)
#3      copyResize (package:image/src/transform/copy_resize.dart:132:15)
#4      Assets.createIcons.generateIcon (package:msix/src/assets.dart:67:26)
#5      Assets.createIcons.<anonymous closure> (package:msix/src/assets.dart:140:13)
#6      _RemoteRunner._run (dart:isolate:1021:47)
#7      _RemoteRunner._remoteExecute (dart:isolate:1015:12)
#8      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:17)
#9      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)

@jlambright
Copy link
Author

Just to help you out: copyResize Usages in MSIX

@brendan-duncan
Copy link
Owner

The webp error seems to be a problem decoding the webp file. If you send me the webp image I can see if there was a problem decoding it. I'll add more unit tests for resizeImage, see if I can find the condition that's causing it to range error.

(I'm pretty slammed with work but I'll do my best to get to this soon)

@YehudaKremer
Copy link

Hello

@jlambright thank you for the report, @brendan-duncan for the reply.

The Msix package works well with version 4.1.0, but breaks on minor version 4.1.1.

As a temporary fix i set the Msix package to work with 4.1.0.

Here is a image that reproduce the error:
logo

Thank you 👍

@jlambright
Copy link
Author

I'm unable to upload webp via Github. However, I did produce it via IntelliJ's built-in WebP conversion tool, on the attached file.
ds_minimalist_logo

@brendan-duncan
Copy link
Owner

Thanks, that's really helpful. Guess I broke something when I added the new features to copyResize. I'll get it fixed up, and take a look at that webp.

@brendan-duncan
Copy link
Owner

I published the fix for the range error in 4.1.3. It was an embarrassing mistake, I mistakenly shadowed a couple variables (x2, y2), and that made the pixel coordinates all wrong.

I'll still take a look at the webp issue.

@brendan-duncan
Copy link
Owner

I wasn't able to reproduce any problem decoding the webp. I downloaded your PNG, used InteliJ to convert it to a WebP (default settings, lossy). I through it in the webp unit tests and it didn't seem to have any problem decoding it.

@YehudaKremer
Copy link

YehudaKremer commented Sep 26, 2023

Hello @brendan-duncan , 4.1.3 fixed the problem 👍

@jlambright thanks again for the quick bug report 👍

I published the fix for the range error in 4.1.3. It was an embarrassing mistake, I mistakenly shadowed a couple variables (x2, y2), and that made the pixel coordinates all wrong.

I'll still take a look at the webp issue.

Happens... Keep up the good work with this important package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants