fix a segv with colour difference

This commit is contained in:
John Cupitt 2012-10-30 10:57:33 +00:00
parent 6e1e3d4be1
commit 8c894f283f
2 changed files with 17 additions and 6 deletions

View File

@ -204,8 +204,8 @@ int
vips__formatalike( VipsImage *in1, VipsImage *in2, vips__formatalike( VipsImage *in1, VipsImage *in2,
VipsImage **out1, VipsImage **out2 ) VipsImage **out1, VipsImage **out2 )
{ {
IMAGE *in[2]; VipsImage *in[2];
IMAGE *out[2]; VipsImage *out[2];
in[0] = in1; in[0] = in1;
in[1] = in2; in[1] = in2;
@ -223,8 +223,8 @@ int
vips__sizealike( VipsImage *in1, VipsImage *in2, vips__sizealike( VipsImage *in1, VipsImage *in2,
VipsImage **out1, VipsImage **out2 ) VipsImage **out1, VipsImage **out2 )
{ {
IMAGE *in[2]; VipsImage *in[2];
IMAGE *out[2]; VipsImage *out[2];
in[0] = in1; in[0] = in1;
in[1] = in2; in[1] = in2;

View File

@ -41,6 +41,7 @@
#include <math.h> #include <math.h>
#include <vips/vips.h> #include <vips/vips.h>
#include <vips/internal.h>
#include "colour.h" #include "colour.h"
@ -419,7 +420,7 @@ vips_colour_difference_build( VipsObject *object )
VipsImage *right; VipsImage *right;
VipsImage *extra; VipsImage *extra;
t = (VipsImage **) vips_object_local_array( object, 10 ); t = (VipsImage **) vips_object_local_array( object, 12 );
left = difference->left; left = difference->left;
right = difference->right; right = difference->right;
@ -514,6 +515,11 @@ vips_colour_difference_build( VipsObject *object )
return( -1 ); return( -1 );
right = t[9]; right = t[9];
if( vips__sizealike( left, right, &t[10], &t[11] ) )
return( -1 );
left = t[10];
right = t[11];
colour->n = 2; colour->n = 2;
colour->in = (VipsImage **) vips_object_local_array( object, 3 ); colour->in = (VipsImage **) vips_object_local_array( object, 3 );
colour->in[0] = left; colour->in[0] = left;
@ -574,8 +580,13 @@ vips_colour_difference_class_init( VipsColourDifferenceClass *class )
static void static void
vips_colour_difference_init( VipsColourDifference *difference ) vips_colour_difference_init( VipsColourDifference *difference )
{ {
} VipsColour *colour = VIPS_COLOUR( difference );
colour->coding = VIPS_CODING_NONE;
colour->interpretation = VIPS_INTERPRETATION_B_W;
colour->format = VIPS_FORMAT_FLOAT;
colour->bands = 1;
}
/* A colour-transforming function. /* A colour-transforming function.
*/ */