Index: trunk/psLib/src/imageops/psImageInterpolate.c
===================================================================
--- trunk/psLib/src/imageops/psImageInterpolate.c	(revision 35158)
+++ trunk/psLib/src/imageops/psImageInterpolate.c	(revision 41522)
@@ -51,4 +51,9 @@
 };
 
+// code below uses statically allocated kernel arrays that need to know the 
+// maximum possible size of a kernel.  16 is >> 8 above
+# define MAX_KERNEL_SIZE 16
+# define USE_MAX_KERNEL 0
+
 # if (IS_BILIN_SEPARABLE)
 /// Generate a linear interpolation kernel
@@ -190,6 +195,10 @@
     switch (mode) {
       case PS_INTERPOLATE_FLAT:
+        // Nothing to pre-compute
+        break;
       case PS_INTERPOLATE_BILINEAR_SIMPLE:
         // Nothing to pre-compute
+	kernel[0] = 1.0 - frac;
+	kernel[1] = frac;
         break;
 # if (IS_BILIN_SEPARABLE)
@@ -793,5 +802,20 @@
 
     // Get the appropriate kernels
+# if (USE_MAX_KERNEL)
+    psAssert (size <= MAX_KERNEL_SIZE, "oops");
+    psF32 kernel[MAX_KERNEL_SIZE][MAX_KERNEL_SIZE];
+    for (int ix = 0; ix < MAX_KERNEL_SIZE; ix++) {
+      for (int iy = 0; iy < MAX_KERNEL_SIZE; iy++) {
+	kernel[ix][iy] = 1;
+      }
+    }
+# else
     psF32 kernel[size][size];
+    for (int ix = 0; ix < size; ix++) {
+      for (int iy = 0; iy < size; iy++) {
+	kernel[ix][iy] = 1;
+      }
+    }
+# endif
 
 # if (IS_BILIN_SEPARABLE)
@@ -1060,5 +1084,14 @@
     if (xExact && yExact) { /* possible alternative */ }
 
+# if (USE_MAX_KERNEL)
+    psAssert (size <= MAX_KERNEL_SIZE, "oops");
+    psF32 xKernel[MAX_KERNEL_SIZE], yKernel[MAX_KERNEL_SIZE]; // Interpolation kernels
+    for (int ix = 0; ix < MAX_KERNEL_SIZE; ix++) { xKernel[ix] = 1; yKernel[ix] = 1; }
+# else
+    // init these arrays
     psF32 xKernel[size], yKernel[size]; // Interpolation kernels
+    for (int ix = 0; ix < size; ix++) { xKernel[ix] = 1; yKernel[ix] = 1; }
+# endif
+
     interpolationKernel(xKernel, xFrac, mode);
     interpolationKernel(yKernel, yFrac, mode);
@@ -1111,5 +1144,13 @@
     if (xExact && yExact) { /* possible alternative */ }
 
+# if (USE_MAX_KERNEL)
+    psAssert (size <= MAX_KERNEL_SIZE, "oops");
+    psF32 xKernel[MAX_KERNEL_SIZE], yKernel[MAX_KERNEL_SIZE]; // Interpolation kernels
+    for (int ix = 0; ix < MAX_KERNEL_SIZE; ix++) { xKernel[ix] = 1; yKernel[ix] = 1; }
+# else
     psF32 xKernel[size], yKernel[size]; // Interpolation kernels
+    for (int ix = 0; ix < size; ix++) { xKernel[ix] = 1; yKernel[ix] = 1; }
+# endif
+
     interpolationKernel(xKernel, xFrac, mode);
     interpolationKernel(yKernel, yFrac, mode);
@@ -1128,4 +1169,8 @@
     int min = -size/2, max = (size - 1) / 2; // Range for kernel
     psKernel *kernel = psKernelAlloc(min, max, min, max); // Kernel to return
+
+    fprintf (stderr, "kernel: %d x %d == %d\n", kernel->image->numRows, kernel->image->numCols, size);
+    psAssert (size == kernel->image->numRows, "oops");
+    psAssert (size == kernel->image->numCols, "oops");
 
     for (int y = 0; y < size; y++) {
