Skip to content

Commit

Permalink
Guard against unexpected overlay band format #97
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Jul 11, 2015
1 parent 2ec845b commit 642e568
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/pipeline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,16 @@ class PipelineWorker : public NanAsyncWorker {
(baton->err).append("Overlay image is of an unsupported image format");
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)) {
(baton->err).append("Overlay image must have an alpha channel");
return Error();
Expand Down

0 comments on commit 642e568

Please sign in to comment.