Sharp: 0.15.1: Additional error from libvips when attempting to extract an invalid area

Created on 14 Jul 2016  路  8Comments  路  Source: lovell/sharp

$ node -e "require('sharp')('testdata/turtle.jpg').extract({left: 10000, top: 10000, width: 10, height: 10}).toBuffer(console.log);"
Error: enum 'VipsOperationBoolean' has no member 'null', should be one of: and, or, eor, lshift, rshift
enum 'VipsOperationBoolean' has no member 'null', should be one of: and, or, eor, lshift, rshift
extract_area: bad extract area

    at Error (native) null null

(turtle.jpg is a 481x424 image)

With sharp 0.15.0 only the last part ("extract_area: bad extract area") was logged. Is that reason for concern?

bug

All 8 comments

Also happens on master (15a5778).

@mhirsch I think the new GetBooleanOperation method needs to avoid the call to vips_enum_from_nick when the opStr is null - are you able to submit a patch for this?

@papandreou Thanks for reporting this. It doesn't affect the function/performance, but does appear to append the warning "noise" to any error messages.

I submitted a pr for this. I'm not sure what happened -- these assignments used to be surrounded by a check for whether the operation in question was requested. The pr takes the approach of checking whether the operations exist in the options object rather than special casing the 'null' operation. Does that sound ok to you?

@papandreou Are you able to confirm @mhirsch's fix (and associated test case) fixes this?

@lovell Confirmed -- doesn't happen on master now.

I think this could be closed now, unless anyone objects.

@mhirsch I didn't close it because @lovell usually likes to keep issues open until a fix has been released.

v0.16.0 is now available via npm.

Was this page helpful?
0 / 5 - 0 ratings