We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
Canvas's toBuffer method throws assertion error.
new (require('canvas').Canvas)(2e4, 2e4).toBuffer('raw');
NAN_METHOD(Canvas::ToBuffer) from Canvas.cc:
NAN_METHOD(Canvas::ToBuffer)
Canvas.cc
if (info.Length() >= 1 && info[0]->StrictEquals(Nan::New<String>("raw").ToLocalChecked())) { // Return raw ARGB data -- just a memcpy() cairo_surface_t *surface = canvas->surface(); cairo_surface_flush(surface); const unsigned char *data = cairo_image_surface_get_data(surface); + if (canvas->nBytes() > 0x3fffffff) + return Nan::ThrowRangeError("Too large buffer"); Local<Object> buf = Nan::CopyBuffer(reinterpret_cast<const char*>(data), canvas->nBytes()).ToLocalChecked(); info.GetReturnValue().Set(buf); return; }
It should probably be done systematic in all places when the CopyBuffer is called.
CopyBuffer
The text was updated successfully, but these errors were encountered:
Fix assertion error with large canvases and toBuffer('raw')
9ce252d
Also allows larger buffers to be returned on 64-bit platforms. Nan only allows 0x3FFFFFFF; Node/v8 allows 0x7FFFFFFF on 64-bit. Fixes Automattic#1158
fedfb20
c1cc378
Also allows larger buffers to be returned on 64-bit platforms. Nan only allows 0x3FFFFFFF; Node/v8 allows 0x7FFFFFFF on 64-bit. Fixes #1158
zbjornson
Successfully merging a pull request may close this issue.
Issue or Feature
Canvas's toBuffer method throws assertion error.
Steps to Reproduce
Fix
NAN_METHOD(Canvas::ToBuffer)
fromCanvas.cc
:It should probably be done systematic in all places when the
CopyBuffer
is called.Your Environment
The text was updated successfully, but these errors were encountered: