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
MaxBufferSize is not enough. #34
Comments
+1 |
Increasing this buffer size by default just like this would be a great temporary fix. |
+1 |
|
In the comment above the MaxBufferSize setting: // TO-DO: make this adaptive based on the initial signature of the image
var MaxBufferSize = 128*1024; I'd be happy to quickly patch this by increasing the buffer size, but I'd be curious to hear from @netroy why or how the buffer size should be adaptive? Is it to prevent excessive memory allocation? |
@zeke, you will deal with such "adaptive" kludges forever, until add true streaming support. See https://github.com/nodeca/probe-image-size. We did it because this package was not supported for a long time. Feel free to reuse as you wish. |
Thanks for that link @puzrin |
@oliverfoster if you plan to use that package, note that it has no SVG support (dropped until someone has time to do it well). From the other hand, there are no such bugs as here :) |
Cool. Isn't the whole point of svg that they have no defined size? |
SVG can be with and without size. Problem is how to terminate early - how to decide with good confidence that input is NOT svg image. Input data is broadcasted to streaming decoders, and then we wait until all decoders fail or someone return good result. All decoders should terminate as early as possible, to minimize reading from input stream. |
I didn't realise you could size them. Cool. In that case I guess you wouldnt really me able to tell the size unless you had at least all of the opening tags and the last one might be right before the end. The XML document format isn't really good for that case as it doesn't really have a header. Might just be better to parse the whole thing as an exception? |
IMHO that would be the same crap like buffer size tune :) Quick-check can test that data begins with |
I look forward to seeing it when it's done. Sounds like I could learn a thing of two. |
Hello.
I got an error,
TypeError: Corrupt JPG, exceeded buffer limits
, when I use image-size with an JPEG image file. But when I increase theMaxBufferSize
inlib/index.js
, it works well.Could you increase the
MaxBufferSize
?What I changed to test:
var MaxBufferSize = 128*1024 * 100;
This is the sample file: https://www.dropbox.com/s/qvat156gv0nq13b/b95ff27a4b146a0b95cb4d5f58189c4f.jpg?dl=0
The text was updated successfully, but these errors were encountered: