File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed
Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ Requires libvips v8.8.1.
66
77#### v0.23.4 - TBD
88
9+ * Handle zero-length Buffer objects when using Node.js v13.2.0+.
10+
911* Improve thread safety by using copy-on-write when updating metadata.
1012 [ #1986 ] ( https://github.com/lovell/sharp/issues/1986 )
1113
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ namespace sharp {
5858 v8::Local<v8::Object> buffer = AttrAs<v8::Object>(input, " buffer" );
5959 descriptor->bufferLength = node::Buffer::Length (buffer);
6060 descriptor->buffer = node::Buffer::Data (buffer);
61+ descriptor->isBuffer = TRUE ;
6162 buffersToPersist.push_back (buffer);
6263 }
6364 descriptor->failOnError = AttrTo<bool >(input, " failOnError" );
@@ -246,7 +247,7 @@ namespace sharp {
246247 std::tuple<VImage, ImageType> OpenInput (InputDescriptor *descriptor, VipsAccess accessMethod) {
247248 VImage image;
248249 ImageType imageType;
249- if (descriptor->buffer != nullptr ) {
250+ if (descriptor->isBuffer ) {
250251 if (descriptor->rawChannels > 0 ) {
251252 // Raw, uncompressed pixel data
252253 image = VImage::new_from_memory (descriptor->buffer , descriptor->bufferLength ,
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ namespace sharp {
4949 char *buffer;
5050 bool failOnError;
5151 size_t bufferLength;
52+ bool isBuffer;
5253 double density;
5354 int rawChannels;
5455 int rawWidth;
@@ -64,6 +65,7 @@ namespace sharp {
6465 buffer (nullptr ),
6566 failOnError (TRUE ),
6667 bufferLength (0 ),
68+ isBuffer (FALSE ),
6769 density (72.0 ),
6870 rawChannels (0 ),
6971 rawWidth (0 ),
You can’t perform that action at this time.
0 commit comments