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.
6
6
7
7
#### v0.23.4 - TBD
8
8
9
+ * Handle zero-length Buffer objects when using Node.js v13.2.0+.
10
+
9
11
* Improve thread safety by using copy-on-write when updating metadata.
10
12
[ #1986 ] ( https://github.com/lovell/sharp/issues/1986 )
11
13
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ namespace sharp {
58
58
v8::Local<v8::Object> buffer = AttrAs<v8::Object>(input, " buffer" );
59
59
descriptor->bufferLength = node::Buffer::Length (buffer);
60
60
descriptor->buffer = node::Buffer::Data (buffer);
61
+ descriptor->isBuffer = TRUE ;
61
62
buffersToPersist.push_back (buffer);
62
63
}
63
64
descriptor->failOnError = AttrTo<bool >(input, " failOnError" );
@@ -246,7 +247,7 @@ namespace sharp {
246
247
std::tuple<VImage, ImageType> OpenInput (InputDescriptor *descriptor, VipsAccess accessMethod) {
247
248
VImage image;
248
249
ImageType imageType;
249
- if (descriptor->buffer != nullptr ) {
250
+ if (descriptor->isBuffer ) {
250
251
if (descriptor->rawChannels > 0 ) {
251
252
// Raw, uncompressed pixel data
252
253
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 {
49
49
char *buffer;
50
50
bool failOnError;
51
51
size_t bufferLength;
52
+ bool isBuffer;
52
53
double density;
53
54
int rawChannels;
54
55
int rawWidth;
@@ -64,6 +65,7 @@ namespace sharp {
64
65
buffer (nullptr ),
65
66
failOnError (TRUE ),
66
67
bufferLength (0 ),
68
+ isBuffer (FALSE ),
67
69
density (72.0 ),
68
70
rawChannels (0 ),
69
71
rawWidth (0 ),
You can’t perform that action at this time.
0 commit comments