gildas-lormeau / zip.js

JavaScript library to zip and unzip files supporting multi-core compression, compression streams, zip64, split files and encryption.
https://gildas-lormeau.github.io/zip.js
BSD 3-Clause "New" or "Revised" License
3.38k stars 510 forks source link

Unexpected "Extra bytes past the end" error when decompressing data in Safari 16.4 #412

Closed Rajek88 closed 1 year ago

Rajek88 commented 1 year ago

Hi, I would like to report an issue, On Safari 16.3, and all other latest browsers, everything worked perfectly fine, But on Safari 16.4, it started me giving the error " [Error] Unhandled Promise Rejection: TypeError: Extra bytes past the end. pipeToFinalize (anonymous function) " When I try to download and extract a zip from the internet, And yes the zip I am trying to use is not corrupt or incomplete, It was working fine with Safari 16.3,

Any help is appreciated, Thanks

gildas-lormeau commented 1 year ago

You should report this bug to Apple. Are you sure you're using the stable version of Safari? Also, do you confirm you don't see this bug in a Chromium-based browser?

Does setting the option useCompressionStream to false fix the issue?

Rajek88 commented 1 year ago

Yes, It's a stable version of Safari, When I checked the network calls, the issue was shown as emerged from zip-full.fs.js

Attaching the screenshot of place where issue is arising from.

On Thu, 4 May 2023, 3:30 pm Gildas, @.***> wrote:

You should report this bug to Apple. Are you sure you're using the stable version of Safari?

— Reply to this email directly, view it on GitHub https://github.com/gildas-lormeau/zip.js/issues/412#issuecomment-1534454909, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMJDGIELJLWGF3K5BBNCR6DXEN45DANCNFSM6AAAAAAXVKWMCY . You are receiving this because you authored the thread.Message ID: @.***>

gildas-lormeau commented 1 year ago

Please upload the screenshot though the GitHub user interface. Attached files in mail don't work on GitHub.

Rajek88 commented 1 year ago

image

Please take a look at attached screenshot

Rajek88 commented 1 year ago

You should report this bug to Apple. Are you sure you're using the stable version of Safari? Also, do you confirm you don't see this bug in a Chromium-based browser?

Does setting the option useCompressionStream to false fix the issue?

Checking by setting useCompressionStream to false, will update

gildas-lormeau commented 1 year ago

The screenshot is not really useful unfortunately. I'm curious if the option change helps. If so, this would confirm that it is a bug in the implementation of the CompressionStream API in Safari. I would not be surprised if it helps since someone already reported a similar issue in Safari, see https://www.construct.net/en/blogs/ashleys-blog-2/safari-releases-development-1616.

gildas-lormeau commented 1 year ago

@AshleyScirra, was your issue similar to this one?

AshleyScirra commented 1 year ago

I don't think it's https://bugs.webkit.org/show_bug.cgi?id=252474 since AFAIK the fix for that was shipped in 16.4. But who knows with Safari.

gildas-lormeau commented 1 year ago

Thanks for your quick reply and the link, I see there is another bug (cf. https://bugs.webkit.org/show_bug.cgi?id=254021) opened on this API. That's not very reassuring. How did they manage to do this? :p

Rajek88 commented 1 year ago

You should report this bug to Apple. Are you sure you're using the stable version of Safari? Also, do you confirm you don't see this bug in a Chromium-based browser?

Does setting the option useCompressionStream to false fix the issue?

Yes, tried by turning useCompressionStream to false and it worked! Thank you so much @gildas-lormeau

gildas-lormeau commented 1 year ago

You're welcome. I reported the bug here: https://bugs.webkit.org/show_bug.cgi?id=256330. Feel free to provide more info if you can. Ideally, it would be great if you could provide a zip file to reproduce the bug.

Rajek88 commented 1 year ago

Sure, please allow me some time

On Fri, 5 May 2023, 6:34 am Gildas, @.***> wrote:

@Rajek88 https://github.com/Rajek88 Could you run again your code, set a breakpoint at line 3174 and test if r < n.size is true please?

— Reply to this email directly, view it on GitHub https://github.com/gildas-lormeau/zip.js/issues/412#issuecomment-1535573031, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMJDGID62GMQG7DQRY3CRNLXERGYHANCNFSM6AAAAAAXVKWMCY . You are receiving this because you were mentioned.Message ID: @.***>

gildas-lormeau commented 1 year ago

@Rajek88 Forget my previous message, I found my answers in your screenshots. However, if you could provide a zip file to reproduce the issue, that would give some hope that Apple would find the bug.

Rajek88 commented 1 year ago

@Rajek88 Forget my previous message, I found my answers in your screenshots. However, if you could provide a zip file to reproduce the issue, that would give some hope that Apple would find the bug.

Hi, @gildas-lormeau , I'm afraid, that as the zip contained some non-sharable information, I cannot share it, sorry for that, But yes, the zip file was about 1MB and was password protected.

gildas-lormeau commented 1 year ago

@Rajek88 Do you know the software that was used to create the zip file maybe?

Rajek88 commented 1 year ago

@Rajek88 Do you know the software that was used to create the zip file maybe?

Hi, sorry for late reply, Missed the notification. Sure, I was using android system to create zip files, You can find the documentation: https://developer.android.com/reference/java/util/zip/ZipEntry

gildas-lormeau commented 1 year ago

I'm closing the issue because I do not expect new info and because it's not a bug in zip.js. Please post any info that could help to fix it here: https://bugs.webkit.org/show_bug.cgi?id=256330.