tools/tiffdump.c:679: error: Integer Overflow L2
  ([0, `count`] - 1):unsigned32.

tools/tiffdump.c:672:1: <LHS trace>
670. }
671. 
672. static void
     ^
673. PrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)
674. {

tools/tiffdump.c:672:1: Parameter `count`
670. }
671. 
672. static void
     ^
673. PrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)
674. {

tools/tiffdump.c:679:10: Binary operation: ([0, count] - 1):unsigned32
677. 	switch (type) {
678. 	case TIFF_BYTE:
679. 		while (count-- > 0)
              ^
680. 			fprintf(fd, bytefmt, sep, *data++), sep = " ";
681. 		break;

static void
PrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)
{
	char* sep = "";
	switch (type) {
	case TIFF_BYTE:
		while (count-- > 0)
			fprintf(fd, bytefmt, sep, *data++), sep = " ";
		break;
	case TIFF_SBYTE:
		while (count-- > 0)
			fprintf(fd, sbytefmt, sep, *(char *)data++), sep = " ";
		break;
	case TIFF_UNDEFINED:
		while (count-- > 0)
			fprintf(fd, bytefmt, sep, *data++), sep = " ";
		break;
	case TIFF_ASCII:
		PrintASCII(fd, count, data);
		break;
	case TIFF_SHORT: {
		uint16 *wp = (uint16*)data;
		while (count-- > 0)
			fprintf(fd, shortfmt, sep, *wp++), sep = " ";
		break;
	}
	case TIFF_SSHORT: {
		int16 *wp = (int16*)data;
		while (count-- > 0)
			fprintf(fd, sshortfmt, sep, *wp++), sep = " ";
		break;
	}
	case TIFF_LONG: {
		uint32 *lp = (uint32*)data;
		while (count-- > 0) {
			fprintf(fd, longfmt, sep, (unsigned long) *lp++);
			sep = " ";
		}
		break;
	}
	case TIFF_SLONG: {
		int32 *lp = (int32*)data;
		while (count-- > 0)
			fprintf(fd, slongfmt, sep, (long) *lp++), sep = " ";
		break;
	}
	case TIFF_LONG8: {
		uint64 *llp = (uint64*)data;
		while (count-- > 0) {
#if defined(__WIN32__) && defined(_MSC_VER)
			fprintf(fd, long8fmt, sep, (unsigned __int64) *llp++);
#else
			fprintf(fd, long8fmt, sep, (unsigned long long) *llp++);
#endif
			sep = " ";
		}
		break;
	}
	case TIFF_SLONG8: {
		int64 *llp = (int64*)data;
		while (count-- > 0)
#if defined(__WIN32__) && defined(_MSC_VER)
			fprintf(fd, slong8fmt, sep, (__int64) *llp++), sep = " ";
#else
			fprintf(fd, slong8fmt, sep, (long long) *llp++), sep = " ";
#endif
		break;
	}
	case TIFF_RATIONAL: {
		uint32 *lp = (uint32*)data;
		while (count-- > 0) {
			if (lp[1] == 0)
				fprintf(fd, "%sNan (%lu/%lu)", sep,
				    (unsigned long) lp[0],
				    (unsigned long) lp[1]);
			else
				fprintf(fd, rationalfmt, sep,
				    (double)lp[0] / (double)lp[1]);
			sep = " ";
			lp += 2;
		}
		break;
	}
	case TIFF_SRATIONAL: {
		int32 *lp = (int32*)data;
		while (count-- > 0) {
			if (lp[1] == 0)
				fprintf(fd, "%sNan (%ld/%ld)", sep,
				    (long) lp[0], (long) lp[1]);
			else
				fprintf(fd, srationalfmt, sep,
				    (double)lp[0] / (double)lp[1]);
			sep = " ";
			lp += 2;
		}
		break;
	}
	case TIFF_FLOAT: {
		float *fp = (float *)data;
		while (count-- > 0)
			fprintf(fd, floatfmt, sep, *fp++), sep = " ";
		break;
	}
	case TIFF_DOUBLE: {
		double *dp = (double *)data;
		while (count-- > 0)
			fprintf(fd, doublefmt, sep, *dp++), sep = " ";
		break;
	}
	case TIFF_IFD: {
		uint32 *lp = (uint32*)data;
		while (count-- > 0) {
			fprintf(fd, ifdfmt, sep, (unsigned long) *lp++);
			sep = " ";
		}
		break;
	}
	case TIFF_IFD8: {
		uint64 *llp = (uint64*)data;
		while (count-- > 0) {
#if defined(__WIN32__) && defined(_MSC_VER)
			fprintf(fd, ifd8fmt, sep, (unsigned __int64) *llp++);
#else
			fprintf(fd, ifd8fmt, sep, (unsigned long long) *llp++);
#endif
			sep = " ";
		}
		break;
	}
	}
}
['static void\nPrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)\n{\n\tchar* sep = "";\n\tswitch (type) {\n\tcase TIFF_BYTE:\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, bytefmt, sep, *data++), sep = " ";\n\t\tbreak;\n\tcase TIFF_SBYTE:\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, sbytefmt, sep, *(char *)data++), sep = " ";\n\t\tbreak;\n\tcase TIFF_UNDEFINED:\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, bytefmt, sep, *data++), sep = " ";\n\t\tbreak;\n\tcase TIFF_ASCII:\n\t\tPrintASCII(fd, count, data);\n\t\tbreak;\n\tcase TIFF_SHORT: {\n\t\tuint16 *wp = (uint16*)data;\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, shortfmt, sep, *wp++), sep = " ";\n\t\tbreak;\n\t}\n\tcase TIFF_SSHORT: {\n\t\tint16 *wp = (int16*)data;\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, sshortfmt, sep, *wp++), sep = " ";\n\t\tbreak;\n\t}\n\tcase TIFF_LONG: {\n\t\tuint32 *lp = (uint32*)data;\n\t\twhile (count-- > 0) {\n\t\t\tfprintf(fd, longfmt, sep, (unsigned long) *lp++);\n\t\t\tsep = " ";\n\t\t}\n\t\tbreak;\n\t}\n\tcase TIFF_SLONG: {\n\t\tint32 *lp = (int32*)data;\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, slongfmt, sep, (long) *lp++), sep = " ";\n\t\tbreak;\n\t}\n\tcase TIFF_LONG8: {\n\t\tuint64 *llp = (uint64*)data;\n\t\twhile (count-- > 0) {\n#if defined(__WIN32__) && defined(_MSC_VER)\n\t\t\tfprintf(fd, long8fmt, sep, (unsigned __int64) *llp++);\n#else\n\t\t\tfprintf(fd, long8fmt, sep, (unsigned long long) *llp++);\n#endif\n\t\t\tsep = " ";\n\t\t}\n\t\tbreak;\n\t}\n\tcase TIFF_SLONG8: {\n\t\tint64 *llp = (int64*)data;\n\t\twhile (count-- > 0)\n#if defined(__WIN32__) && defined(_MSC_VER)\n\t\t\tfprintf(fd, slong8fmt, sep, (__int64) *llp++), sep = " ";\n#else\n\t\t\tfprintf(fd, slong8fmt, sep, (long long) *llp++), sep = " ";\n#endif\n\t\tbreak;\n\t}\n\tcase TIFF_RATIONAL: {\n\t\tuint32 *lp = (uint32*)data;\n\t\twhile (count-- > 0) {\n\t\t\tif (lp[1] == 0)\n\t\t\t\tfprintf(fd, "%sNan (%lu/%lu)", sep,\n\t\t\t\t    (unsigned long) lp[0],\n\t\t\t\t    (unsigned long) lp[1]);\n\t\t\telse\n\t\t\t\tfprintf(fd, rationalfmt, sep,\n\t\t\t\t    (double)lp[0] / (double)lp[1]);\n\t\t\tsep = " ";\n\t\t\tlp += 2;\n\t\t}\n\t\tbreak;\n\t}\n\tcase TIFF_SRATIONAL: {\n\t\tint32 *lp = (int32*)data;\n\t\twhile (count-- > 0) {\n\t\t\tif (lp[1] == 0)\n\t\t\t\tfprintf(fd, "%sNan (%ld/%ld)", sep,\n\t\t\t\t    (long) lp[0], (long) lp[1]);\n\t\t\telse\n\t\t\t\tfprintf(fd, srationalfmt, sep,\n\t\t\t\t    (double)lp[0] / (double)lp[1]);\n\t\t\tsep = " ";\n\t\t\tlp += 2;\n\t\t}\n\t\tbreak;\n\t}\n\tcase TIFF_FLOAT: {\n\t\tfloat *fp = (float *)data;\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, floatfmt, sep, *fp++), sep = " ";\n\t\tbreak;\n\t}\n\tcase TIFF_DOUBLE: {\n\t\tdouble *dp = (double *)data;\n\t\twhile (count-- > 0)\n\t\t\tfprintf(fd, doublefmt, sep, *dp++), sep = " ";\n\t\tbreak;\n\t}\n\tcase TIFF_IFD: {\n\t\tuint32 *lp = (uint32*)data;\n\t\twhile (count-- > 0) {\n\t\t\tfprintf(fd, ifdfmt, sep, (unsigned long) *lp++);\n\t\t\tsep = " ";\n\t\t}\n\t\tbreak;\n\t}\n\tcase TIFF_IFD8: {\n\t\tuint64 *llp = (uint64*)data;\n\t\twhile (count-- > 0) {\n#if defined(__WIN32__) && defined(_MSC_VER)\n\t\t\tfprintf(fd, ifd8fmt, sep, (unsigned __int64) *llp++);\n#else\n\t\t\tfprintf(fd, ifd8fmt, sep, (unsigned long long) *llp++);\n#endif\n\t\t\tsep = " ";\n\t\t}\n\t\tbreak;\n\t}\n\t}\n}']