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

TypeError: Cannot read property 'precision' of undefined #63

Open
donmahallem opened this issue Jan 15, 2020 · 0 comments
Open

TypeError: Cannot read property 'precision' of undefined #63

donmahallem opened this issue Jan 15, 2020 · 0 comments
Labels

Comments

@donmahallem
Copy link
Contributor

If the provided JPEG has no SOF marker before the SOS marker the decode will crash line https://github.com/eugeneware/jpeg-js/blob/d340c1b2113328bdea955706e7c5f0bf0cad143b/lib/decoder.js#L97 as the frame is undefined.

To reproduce:

const jpeg = require("jpeg-js");
const buf = new Buffer("ffd8ffffffda", "hex");
jpeg.decode(buf);

I would help out with an PR but I am not sure where to implement the check and how extensive it should be as for example the SOI marker should appear before all the above or if just check if frame is defined inside the SOS handler.

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

No branches or pull requests

2 participants