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

tools/tiff2pdf.c:1823:1: start of procedure t2p_read_tiff_size()
1821. */
1822. 
1823. void t2p_read_tiff_size(T2P* t2p, TIFF* input){
      ^
1824. 
1825. 	uint64* sbc=NULL;

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

tools/tiff2pdf.c:1827:2: 
1825. 	uint64* sbc=NULL;
1826. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)
1827. 	unsigned char* jpt=NULL;
       ^
1828. 	tstrip_t i=0;
1829. 	tstrip_t stripcount=0;

tools/tiff2pdf.c:1828:2: 
1826. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)
1827. 	unsigned char* jpt=NULL;
1828. 	tstrip_t i=0;
       ^
1829. 	tstrip_t stripcount=0;
1830. #endif

tools/tiff2pdf.c:1829:2: 
1827. 	unsigned char* jpt=NULL;
1828. 	tstrip_t i=0;
1829. 	tstrip_t stripcount=0;
       ^
1830. #endif
1831. #ifdef OJPEG_SUPPORT

tools/tiff2pdf.c:1832:9: 
1830. #endif
1831. #ifdef OJPEG_SUPPORT
1832.         tsize_t k = 0;
              ^
1833. #endif
1834. 

tools/tiff2pdf.c:1835:5: Taking true branch
1833. #endif
1834. 
1835. 	if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){
          ^
1836. #ifdef CCITT_SUPPORT
1837. 		if(t2p->pdf_compression == T2P_COMPRESS_G4 ){

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

tools/tiff2pdf.c:1838:4: 
1836. #ifdef CCITT_SUPPORT
1837. 		if(t2p->pdf_compression == T2P_COMPRESS_G4 ){
1838. 			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
         ^
1839. 			t2p->tiff_datasize=sbc[0];
1840. 			return;

libtiff/tif_dir.c:1029:1: start of procedure TIFFGetField()
  1027.  * internal directory structure.
  1028.  */
  1029. int
        ^
  1030. TIFFGetField(TIFF* tif, uint32 tag, ...)
  1031. {

libtiff/tif_dir.c:1035:2: 
  1033. 	va_list ap;
  1034. 
  1035. 	va_start(ap, tag);
         ^
  1036. 	status = TIFFVGetField(tif, tag, ap);
  1037. 	va_end(ap);

libtiff/tif_dir.c:1036:2: Skipping TIFFVGetField(): empty list of specs
  1034. 
  1035. 	va_start(ap, tag);
  1036. 	status = TIFFVGetField(tif, tag, ap);
         ^
  1037. 	va_end(ap);
  1038. 	return (status);

libtiff/tif_dir.c:1037:2: 
  1035. 	va_start(ap, tag);
  1036. 	status = TIFFVGetField(tif, tag, ap);
  1037. 	va_end(ap);
         ^
  1038. 	return (status);
  1039. }

libtiff/tif_dir.c:1038:2: 
  1036. 	status = TIFFVGetField(tif, tag, ap);
  1037. 	va_end(ap);
  1038. 	return (status);
         ^
  1039. }
  1040. 

libtiff/tif_dir.c:1039:1: return from a call to TIFFGetField
  1037. 	va_end(ap);
  1038. 	return (status);
  1039. }
        ^
  1040. 
  1041. /*

tools/tiff2pdf.c:1839:4: 
1837. 		if(t2p->pdf_compression == T2P_COMPRESS_G4 ){
1838. 			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
1839. 			t2p->tiff_datasize=sbc[0];
         ^
1840. 			return;
1841. 		}

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=sbc[0];
			return;
		}
#endif
#ifdef ZIP_SUPPORT
		if(t2p->pdf_compression == T2P_COMPRESS_ZIP){
			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
			t2p->tiff_datasize=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=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=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}']