tools/tiff2pdf.c:1843: error: Null Dereference
  pointer `sbc` last assigned on line 1829 could be null and is dereferenced at line 1843, column 33.

tools/tiff2pdf.c:1827:1: start of procedure t2p_read_tiff_size()
1825. */
1826. 
1827. void t2p_read_tiff_size(T2P* t2p, TIFF* input){
      ^
1828. 
1829. 	uint64* sbc=NULL;

tools/tiff2pdf.c:1829:2: 
1827. void t2p_read_tiff_size(T2P* t2p, TIFF* input){
1828. 
1829. 	uint64* sbc=NULL;
       ^
1830. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)
1831. 	unsigned char* jpt=NULL;

tools/tiff2pdf.c:1831:2: 
1829. 	uint64* sbc=NULL;
1830. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)
1831. 	unsigned char* jpt=NULL;
       ^
1832. 	tstrip_t i=0;
1833. 	tstrip_t stripcount=0;

tools/tiff2pdf.c:1832:2: 
1830. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)
1831. 	unsigned char* jpt=NULL;
1832. 	tstrip_t i=0;
       ^
1833. 	tstrip_t stripcount=0;
1834. #endif

tools/tiff2pdf.c:1833:2: 
1831. 	unsigned char* jpt=NULL;
1832. 	tstrip_t i=0;
1833. 	tstrip_t stripcount=0;
       ^
1834. #endif
1835. #ifdef OJPEG_SUPPORT

tools/tiff2pdf.c:1836:9: 
1834. #endif
1835. #ifdef OJPEG_SUPPORT
1836.         tsize_t k = 0;
              ^
1837. #endif
1838. 

tools/tiff2pdf.c:1839:5: Taking true branch
1837. #endif
1838. 
1839. 	if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){
          ^
1840. #ifdef CCITT_SUPPORT
1841. 		if(t2p->pdf_compression == T2P_COMPRESS_G4 ){

tools/tiff2pdf.c:1841:6: Taking true branch
1839. 	if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){
1840. #ifdef CCITT_SUPPORT
1841. 		if(t2p->pdf_compression == T2P_COMPRESS_G4 ){
           ^
1842. 			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
1843. 			t2p->tiff_datasize=(tmsize_t)sbc[0];

tools/tiff2pdf.c:1842:4: 
1840. #ifdef CCITT_SUPPORT
1841. 		if(t2p->pdf_compression == T2P_COMPRESS_G4 ){
1842. 			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
         ^
1843. 			t2p->tiff_datasize=(tmsize_t)sbc[0];
1844. 			return;

libtiff/tif_dir.c:1048:1: start of procedure TIFFGetField()
  1046.  * internal directory structure.
  1047.  */
  1048. int
        ^
  1049. TIFFGetField(TIFF* tif, uint32 tag, ...)
  1050. {

libtiff/tif_dir.c:1054:2: 
  1052. 	va_list ap;
  1053. 
  1054. 	va_start(ap, tag);
         ^
  1055. 	status = TIFFVGetField(tif, tag, ap);
  1056. 	va_end(ap);

libtiff/tif_dir.c:1055:2: Skipping TIFFVGetField(): empty list of specs
  1053. 
  1054. 	va_start(ap, tag);
  1055. 	status = TIFFVGetField(tif, tag, ap);
         ^
  1056. 	va_end(ap);
  1057. 	return (status);

libtiff/tif_dir.c:1056:2: 
  1054. 	va_start(ap, tag);
  1055. 	status = TIFFVGetField(tif, tag, ap);
  1056. 	va_end(ap);
         ^
  1057. 	return (status);
  1058. }

libtiff/tif_dir.c:1057:2: 
  1055. 	status = TIFFVGetField(tif, tag, ap);
  1056. 	va_end(ap);
  1057. 	return (status);
         ^
  1058. }
  1059. 

libtiff/tif_dir.c:1058:1: return from a call to TIFFGetField
  1056. 	va_end(ap);
  1057. 	return (status);
  1058. }
        ^
  1059. 
  1060. /*

tools/tiff2pdf.c:1843:4: 
1841. 		if(t2p->pdf_compression == T2P_COMPRESS_G4 ){
1842. 			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
1843. 			t2p->tiff_datasize=(tmsize_t)sbc[0];
         ^
1844. 			return;
1845. 		}

void t2p_read_tiff_size(T2P* t2p, TIFF* input){
	uint64* sbc=NULL;
#if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)
	unsigned char* jpt=NULL;
	tstrip_t i=0;
	tstrip_t stripcount=0;
#endif
#ifdef OJPEG_SUPPORT
        tsize_t k = 0;
#endif
	if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){
#ifdef CCITT_SUPPORT
		if(t2p->pdf_compression == T2P_COMPRESS_G4 ){
			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
			t2p->tiff_datasize=(tmsize_t)sbc[0];
			return;
		}
#endif
#ifdef ZIP_SUPPORT
		if(t2p->pdf_compression == T2P_COMPRESS_ZIP){
			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
			t2p->tiff_datasize=(tmsize_t)sbc[0];
			return;
		}
#endif
#ifdef OJPEG_SUPPORT
		if(t2p->tiff_compression == COMPRESSION_OJPEG){
			if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){
				TIFFError(TIFF2PDF_MODULE,
					"Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS",
					TIFFFileName(input));
				t2p->t2p_error = T2P_ERR_ERROR;
				return;
			}
			stripcount=TIFFNumberOfStrips(input);
			for(i=0;i<stripcount;i++){
				k += sbc[i];
			}
			if(TIFFGetField(input, TIFFTAG_JPEGIFOFFSET, &(t2p->tiff_dataoffset))){
				if(t2p->tiff_dataoffset != 0){
					if(TIFFGetField(input, TIFFTAG_JPEGIFBYTECOUNT, &(t2p->tiff_datasize))!=0){
						if(t2p->tiff_datasize < k) {
							t2p->pdf_ojpegiflength=t2p->tiff_datasize;
							t2p->tiff_datasize+=k;
							t2p->tiff_datasize+=6;
							t2p->tiff_datasize+=2*stripcount;
							TIFFWarning(TIFF2PDF_MODULE,
								"Input file %s has short JPEG interchange file byte count",
								TIFFFileName(input));
							return;
						}
						return;
					}else {
						TIFFError(TIFF2PDF_MODULE,
							"Input file %s missing field: TIFFTAG_JPEGIFBYTECOUNT",
							TIFFFileName(input));
							t2p->t2p_error = T2P_ERR_ERROR;
							return;
					}
				}
			}
			t2p->tiff_datasize+=k;
			t2p->tiff_datasize+=2*stripcount;
			t2p->tiff_datasize+=2048;
			return;
		}
#endif
#ifdef JPEG_SUPPORT
		if(t2p->tiff_compression == COMPRESSION_JPEG) {
			uint32 count = 0;
			if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0 ){
				if(count > 4){
					t2p->tiff_datasize += count;
					t2p->tiff_datasize -= 2;
				}
			} else {
				t2p->tiff_datasize = 2;
			}
			stripcount=TIFFNumberOfStrips(input);
			if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){
				TIFFError(TIFF2PDF_MODULE,
					"Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS",
					TIFFFileName(input));
				t2p->t2p_error = T2P_ERR_ERROR;
				return;
			}
			for(i=0;i<stripcount;i++){
				t2p->tiff_datasize += sbc[i];
				t2p->tiff_datasize -=4;
			}
			t2p->tiff_datasize +=2;
		}
#endif
		(void) 0;
	}
	t2p->tiff_datasize=TIFFScanlineSize(input) * t2p->tiff_length;
	if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){
		t2p->tiff_datasize*= t2p->tiff_samplesperpixel;
	}
	return;
}
['void t2p_read_tiff_size(T2P* t2p, TIFF* input){\n\tuint64* sbc=NULL;\n#if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)\n\tunsigned char* jpt=NULL;\n\ttstrip_t i=0;\n\ttstrip_t stripcount=0;\n#endif\n#ifdef OJPEG_SUPPORT\n        tsize_t k = 0;\n#endif\n\tif(t2p->pdf_transcode == T2P_TRANSCODE_RAW){\n#ifdef CCITT_SUPPORT\n\t\tif(t2p->pdf_compression == T2P_COMPRESS_G4 ){\n\t\t\tTIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);\n\t\t\tt2p->tiff_datasize=(tmsize_t)sbc[0];\n\t\t\treturn;\n\t\t}\n#endif\n#ifdef ZIP_SUPPORT\n\t\tif(t2p->pdf_compression == T2P_COMPRESS_ZIP){\n\t\t\tTIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);\n\t\t\tt2p->tiff_datasize=(tmsize_t)sbc[0];\n\t\t\treturn;\n\t\t}\n#endif\n#ifdef OJPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_OJPEG){\n\t\t\tif(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t"Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS",\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstripcount=TIFFNumberOfStrips(input);\n\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\tk += sbc[i];\n\t\t\t}\n\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGIFOFFSET, &(t2p->tiff_dataoffset))){\n\t\t\t\tif(t2p->tiff_dataoffset != 0){\n\t\t\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGIFBYTECOUNT, &(t2p->tiff_datasize))!=0){\n\t\t\t\t\t\tif(t2p->tiff_datasize < k) {\n\t\t\t\t\t\t\tt2p->pdf_ojpegiflength=t2p->tiff_datasize;\n\t\t\t\t\t\t\tt2p->tiff_datasize+=k;\n\t\t\t\t\t\t\tt2p->tiff_datasize+=6;\n\t\t\t\t\t\t\tt2p->tiff_datasize+=2*stripcount;\n\t\t\t\t\t\t\tTIFFWarning(TIFF2PDF_MODULE,\n\t\t\t\t\t\t\t\t"Input file %s has short JPEG interchange file byte count",\n\t\t\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\t\t"Input file %s missing field: TIFFTAG_JPEGIFBYTECOUNT",\n\t\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tt2p->tiff_datasize+=k;\n\t\t\tt2p->tiff_datasize+=2*stripcount;\n\t\t\tt2p->tiff_datasize+=2048;\n\t\t\treturn;\n\t\t}\n#endif\n#ifdef JPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_JPEG) {\n\t\t\tuint32 count = 0;\n\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0 ){\n\t\t\t\tif(count > 4){\n\t\t\t\t\tt2p->tiff_datasize += count;\n\t\t\t\t\tt2p->tiff_datasize -= 2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tt2p->tiff_datasize = 2;\n\t\t\t}\n\t\t\tstripcount=TIFFNumberOfStrips(input);\n\t\t\tif(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t"Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS",\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\tt2p->tiff_datasize += sbc[i];\n\t\t\t\tt2p->tiff_datasize -=4;\n\t\t\t}\n\t\t\tt2p->tiff_datasize +=2;\n\t\t}\n#endif\n\t\t(void) 0;\n\t}\n\tt2p->tiff_datasize=TIFFScanlineSize(input) * t2p->tiff_length;\n\tif(t2p->tiff_planar==PLANARCONFIG_SEPARATE){\n\t\tt2p->tiff_datasize*= t2p->tiff_samplesperpixel;\n\t}\n\treturn;\n}', 'int\nTIFFGetField(TIFF* tif, uint32 tag, ...)\n{\n\tint status;\n\tva_list ap;\n\tva_start(ap, tag);\n\tstatus = TIFFVGetField(tif, tag, ap);\n\tva_end(ap);\n\treturn (status);\n}']