Code Monkey home page Code Monkey logo

Comments (12)

photopea avatar photopea commented on May 26, 2024

Hi, this function is only used for Encoding PNG, not for decoding. What kind of "abnormal" ArrayBuffer did you put into it?

from upng.js.

Aqours avatar Aqours commented on May 26, 2024

oh, I copy wrong line.

UPNG.js/UPNG.js

Line 480 in c62ddc8

while(true)

Abnormal arraybuffer obtained by FileReader API.

from upng.js.

photopea avatar photopea commented on May 26, 2024

How long is your ArrayBuffer? What makes it "abnormal" ? Can you send us your PNG file to [email protected] ?

from upng.js.

photopea avatar photopea commented on May 26, 2024

The image, that you sent us, is a JPG image. This library can work only with PNG images. You should use some different library for parsing JPG images.

from upng.js.

Aqours avatar Aqours commented on May 26, 2024

I pay no attention to its size. Looks very small. And log “unknow chunk type”.
You can download here https://github.com/Aqours/APNG-Codec/blob/master/test/elephant.png
Look like iOS cannot download apng.

from upng.js.

photopea avatar photopea commented on May 26, 2024

I tried to open your APNG with this version of UPNG.js and it works well.

Can you try to update your UPNG.js file? Are you sure you are sending an arraybuffer into decode(), not your FileReader or anything else?

from upng.js.

Aqours avatar Aqours commented on May 26, 2024

It works fine if using ArrayBuffer from 'correct' but not FileReader.
ArrayBuffer from FileReader maybe not suitable for UPNG.decode method, but it should not decode infinite loop, because sometimes we don't know whether the ArrayBuffer is suitable for UPNG.decode method or not.

from upng.js.

photopea avatar photopea commented on May 26, 2024

what do you mean by "correct"? whenever UPNG gets a valid PNG file, it should decode it in finite time.

from upng.js.

Aqours avatar Aqours commented on May 26, 2024

demo1 - http://git.hub.moe/laboratory/decode-apng-normal.html (open this link with modern browser)
this demo works fine.

demo2 - http://git.hub.moe/laboratory/decode-apng-abnormal.html
this demo does not work.
you will see some message on browser's console.
tim 20171122114605

from upng.js.

photopea avatar photopea commented on May 26, 2024

In your picture, I see a message, that your PNG file was not found. This is not related to UPNG.js

The message from UPNG.js basically says, that you are not giving it a PNG file, but some other file (like PDF or EXE or something).

from upng.js.

Aqours avatar Aqours commented on May 26, 2024

I mean that unexpected arraybuffer should not cause UPNG.js blocking browser, because sometimes we don't kown whether the arraybuffer decoded by UPNG.js is excepted or not. (Inexistence png is just for demo)
Throw an error or other ways might be better solution.

from upng.js.

photopea avatar photopea commented on May 26, 2024

Ok, I added some basic PNG check. If the ArrayBuffer on the input is not a PNG file, it should throw an exception.

from upng.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.