tools/tiffmedian.c:362: error: Integer Overflow L2
  ([0, 32768] - 1):unsigned32.

tools/tiffmedian.c:362:9: <LHS trace>
360. 
361. 	{ register uint32 *ptr = &histogram[0][0][0];
362. 	  for (i = B_LEN*B_LEN*B_LEN; i-- > 0;)
             ^
363. 		*ptr++ = 0;
364. 	}

tools/tiffmedian.c:362:9: Assignment
360. 
361. 	{ register uint32 *ptr = &histogram[0][0][0];
362. 	  for (i = B_LEN*B_LEN*B_LEN; i-- > 0;)
             ^
363. 		*ptr++ = 0;
364. 	}

tools/tiffmedian.c:362:32: Binary operation: ([0, 32768] - 1):unsigned32
360. 
361. 	{ register uint32 *ptr = &histogram[0][0][0];
362. 	  for (i = B_LEN*B_LEN*B_LEN; i-- > 0;)
                                    ^
363. 		*ptr++ = 0;
364. 	}

static void
get_histogram(TIFF* in, Colorbox* box)
{
	register unsigned char *inptr;
	register int red, green, blue;
	register uint32 j, i;
	unsigned char *inputline;
	inputline = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
	if (inputline == NULL) {
		fprintf(stderr, "No space for scanline buffer\n");
		exit(-1);
	}
	box->rmin = box->gmin = box->bmin = 999;
	box->rmax = box->gmax = box->bmax = -1;
	box->total = imagewidth * imagelength;
	{ register uint32 *ptr = &histogram[0][0][0];
	  for (i = B_LEN*B_LEN*B_LEN; i-- > 0;)
		*ptr++ = 0;
	}
	for (i = 0; i < imagelength; i++) {
		if (TIFFReadScanline(in, inputline, i, 0) <= 0)
			break;
		inptr = inputline;
		for (j = imagewidth; j-- > 0;) {
			red = *inptr++ >> COLOR_SHIFT;
			green = *inptr++ >> COLOR_SHIFT;
			blue = *inptr++ >> COLOR_SHIFT;
			if (red < box->rmin)
				box->rmin = red;
		        if (red > box->rmax)
				box->rmax = red;
		        if (green < box->gmin)
				box->gmin = green;
		        if (green > box->gmax)
				box->gmax = green;
		        if (blue < box->bmin)
				box->bmin = blue;
		        if (blue > box->bmax)
				box->bmax = blue;
		        histogram[red][green][blue]++;
		}
	}
	_TIFFfree(inputline);
}
['static void\nget_histogram(TIFF* in, Colorbox* box)\n{\n\tregister unsigned char *inptr;\n\tregister int red, green, blue;\n\tregister uint32 j, i;\n\tunsigned char *inputline;\n\tinputline = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));\n\tif (inputline == NULL) {\n\t\tfprintf(stderr, "No space for scanline buffer\\n");\n\t\texit(-1);\n\t}\n\tbox->rmin = box->gmin = box->bmin = 999;\n\tbox->rmax = box->gmax = box->bmax = -1;\n\tbox->total = imagewidth * imagelength;\n\t{ register uint32 *ptr = &histogram[0][0][0];\n\t  for (i = B_LEN*B_LEN*B_LEN; i-- > 0;)\n\t\t*ptr++ = 0;\n\t}\n\tfor (i = 0; i < imagelength; i++) {\n\t\tif (TIFFReadScanline(in, inputline, i, 0) <= 0)\n\t\t\tbreak;\n\t\tinptr = inputline;\n\t\tfor (j = imagewidth; j-- > 0;) {\n\t\t\tred = *inptr++ >> COLOR_SHIFT;\n\t\t\tgreen = *inptr++ >> COLOR_SHIFT;\n\t\t\tblue = *inptr++ >> COLOR_SHIFT;\n\t\t\tif (red < box->rmin)\n\t\t\t\tbox->rmin = red;\n\t\t        if (red > box->rmax)\n\t\t\t\tbox->rmax = red;\n\t\t        if (green < box->gmin)\n\t\t\t\tbox->gmin = green;\n\t\t        if (green > box->gmax)\n\t\t\t\tbox->gmax = green;\n\t\t        if (blue < box->bmin)\n\t\t\t\tbox->bmin = blue;\n\t\t        if (blue > box->bmax)\n\t\t\t\tbox->bmax = blue;\n\t\t        histogram[red][green][blue]++;\n\t\t}\n\t}\n\t_TIFFfree(inputline);\n}']