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

tools/tiff2pdf.c:1772:1: start of procedure t2p_read_tiff_size()
1770. */
1771. 
1772. void t2p_read_tiff_size(T2P* t2p, TIFF* input){
      ^
1773. 
1774. 	uint64* sbc=NULL;

tools/tiff2pdf.c:1774:2: 
1772. void t2p_read_tiff_size(T2P* t2p, TIFF* input){
1773. 
1774. 	uint64* sbc=NULL;
       ^
1775. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)
1776. 	unsigned char* jpt=NULL;

tools/tiff2pdf.c:1776:2: 
1774. 	uint64* sbc=NULL;
1775. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)
1776. 	unsigned char* jpt=NULL;
       ^
1777. 	tstrip_t i=0;
1778. 	tstrip_t stripcount=0;

tools/tiff2pdf.c:1777:2: 
1775. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)
1776. 	unsigned char* jpt=NULL;
1777. 	tstrip_t i=0;
       ^
1778. 	tstrip_t stripcount=0;
1779. #endif

tools/tiff2pdf.c:1778:2: 
1776. 	unsigned char* jpt=NULL;
1777. 	tstrip_t i=0;
1778. 	tstrip_t stripcount=0;
       ^
1779. #endif
1780. #ifdef OJPEG_SUPPORT

tools/tiff2pdf.c:1781:9: 
1779. #endif
1780. #ifdef OJPEG_SUPPORT
1781.         tsize_t k = 0;
              ^
1782. #endif
1783. 

tools/tiff2pdf.c:1784:5: Taking true branch
1782. #endif
1783. 
1784. 	if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){
          ^
1785. #ifdef CCITT_SUPPORT
1786. 		if(t2p->pdf_compression == T2P_COMPRESS_G4 ){

tools/tiff2pdf.c:1786:6: Taking false branch
1784. 	if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){
1785. #ifdef CCITT_SUPPORT
1786. 		if(t2p->pdf_compression == T2P_COMPRESS_G4 ){
           ^
1787. 			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
1788. 			t2p->tiff_datasize=(tmsize_t)sbc[0];

tools/tiff2pdf.c:1793:6: Taking true branch
1791. #endif
1792. #ifdef ZIP_SUPPORT
1793. 		if(t2p->pdf_compression == T2P_COMPRESS_ZIP){
           ^
1794. 			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
1795. 			t2p->tiff_datasize=(tmsize_t)sbc[0];

tools/tiff2pdf.c:1794:4: 
1792. #ifdef ZIP_SUPPORT
1793. 		if(t2p->pdf_compression == T2P_COMPRESS_ZIP){
1794. 			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
         ^
1795. 			t2p->tiff_datasize=(tmsize_t)sbc[0];
1796. 			return;

libtiff/tif_dir.c:1100:1: start of procedure TIFFGetField()
  1098.  * internal directory structure.
  1099.  */
  1100. int
        ^
  1101. TIFFGetField(TIFF* tif, uint32 tag, ...)
  1102. {

libtiff/tif_dir.c:1106:2: 
  1104. 	va_list ap;
  1105. 
  1106. 	va_start(ap, tag);
         ^
  1107. 	status = TIFFVGetField(tif, tag, ap);
  1108. 	va_end(ap);

libtiff/tif_dir.c:1107:2: Skipping TIFFVGetField(): empty list of specs
  1105. 
  1106. 	va_start(ap, tag);
  1107. 	status = TIFFVGetField(tif, tag, ap);
         ^
  1108. 	va_end(ap);
  1109. 	return (status);

libtiff/tif_dir.c:1108:2: 
  1106. 	va_start(ap, tag);
  1107. 	status = TIFFVGetField(tif, tag, ap);
  1108. 	va_end(ap);
         ^
  1109. 	return (status);
  1110. }

libtiff/tif_dir.c:1109:2: 
  1107. 	status = TIFFVGetField(tif, tag, ap);
  1108. 	va_end(ap);
  1109. 	return (status);
         ^
  1110. }
  1111. 

libtiff/tif_dir.c:1110:1: return from a call to TIFFGetField
  1108. 	va_end(ap);
  1109. 	return (status);
  1110. }
        ^
  1111. 
  1112. /*

tools/tiff2pdf.c:1795:4: 
1793. 		if(t2p->pdf_compression == T2P_COMPRESS_ZIP){
1794. 			TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);
1795. 			t2p->tiff_datasize=(tmsize_t)sbc[0];
         ^
1796. 			return;
1797. 		}

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;
			return;
		}
#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\treturn;\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}']