mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Guard against unexpected overlay band format #97
This commit is contained in:
parent
2ec845b083
commit
642e5687b6
@ -726,6 +726,16 @@ class PipelineWorker : public NanAsyncWorker {
|
|||||||
(baton->err).append("Overlay image is of an unsupported image format");
|
(baton->err).append("Overlay image is of an unsupported image format");
|
||||||
return Error();
|
return Error();
|
||||||
}
|
}
|
||||||
|
if (image->BandFmt != VIPS_FORMAT_UCHAR && image->BandFmt != VIPS_FORMAT_FLOAT) {
|
||||||
|
(baton->err).append("Expected image band format to be uchar or float: ");
|
||||||
|
(baton->err).append(vips_enum_nick(VIPS_TYPE_BAND_FORMAT, image->BandFmt));
|
||||||
|
return Error();
|
||||||
|
}
|
||||||
|
if (overlayImage->BandFmt != VIPS_FORMAT_UCHAR && overlayImage->BandFmt != VIPS_FORMAT_FLOAT) {
|
||||||
|
(baton->err).append("Expected overlay image band format to be uchar or float: ");
|
||||||
|
(baton->err).append(vips_enum_nick(VIPS_TYPE_BAND_FORMAT, overlayImage->BandFmt));
|
||||||
|
return Error();
|
||||||
|
}
|
||||||
if (!HasAlpha(overlayImage)) {
|
if (!HasAlpha(overlayImage)) {
|
||||||
(baton->err).append("Overlay image must have an alpha channel");
|
(baton->err).append("Overlay image must have an alpha channel");
|
||||||
return Error();
|
return Error();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user