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

tools/tiff2pdf.c:1933:1: start of procedure t2p_read_tiff_size_tile()
1931. */
1932. 
1933. void t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){
      ^
1934. 
1935. 	uint64* tbc = NULL;

tools/tiff2pdf.c:1935:2: 
1933. void t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){
1934. 
1935. 	uint64* tbc = NULL;
       ^
1936. 	uint16 edge=0;
1937. #ifdef JPEG_SUPPORT

tools/tiff2pdf.c:1936:2: 
1934. 
1935. 	uint64* tbc = NULL;
1936. 	uint16 edge=0;
       ^
1937. #ifdef JPEG_SUPPORT
1938. 	unsigned char* jpt;

tools/tiff2pdf.c:1941:2: 
1939. #endif
1940. 
1941. 	edge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
       ^
1942. 	edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
1943. 	

tools/tiff2pdf.c:1988:1: start of procedure t2p_tile_is_right_edge()
  1986.  */
  1987. 
  1988. int t2p_tile_is_right_edge(T2P_TILES tiles, ttile_t tile){
        ^
  1989. 
  1990. 	if( ((tile+1) % tiles.tiles_tilecountx == 0) 

tools/tiff2pdf.c:1990:7: Taking false branch
  1988. int t2p_tile_is_right_edge(T2P_TILES tiles, ttile_t tile){
  1989. 
  1990. 	if( ((tile+1) % tiles.tiles_tilecountx == 0) 
              ^
  1991. 		&& (tiles.tiles_edgetilewidth != 0) ){
  1992. 		return(1);

tools/tiff2pdf.c:1994:3: 
  1992. 		return(1);
  1993. 	} else {
  1994. 		return(0);
          ^
  1995. 	}
  1996. }

tools/tiff2pdf.c:1996:1: return from a call to t2p_tile_is_right_edge
  1994. 		return(0);
  1995. 	}
  1996. }
        ^
  1997. 
  1998. /*

tools/tiff2pdf.c:1942:2: 
1940. 
1941. 	edge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
1942. 	edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
       ^
1943. 	
1944. 	if(t2p->pdf_transcode==T2P_TRANSCODE_RAW){

tools/tiff2pdf.c:2003:1: start of procedure t2p_tile_is_bottom_edge()
  2001.  */
  2002. 
  2003. int t2p_tile_is_bottom_edge(T2P_TILES tiles, ttile_t tile){
        ^
  2004. 
  2005. 	if( ((tile+1) > (tiles.tiles_tilecount-tiles.tiles_tilecountx) )

tools/tiff2pdf.c:2005:7: Taking false branch
  2003. int t2p_tile_is_bottom_edge(T2P_TILES tiles, ttile_t tile){
  2004. 
  2005. 	if( ((tile+1) > (tiles.tiles_tilecount-tiles.tiles_tilecountx) )
              ^
  2006. 		&& (tiles.tiles_edgetilelength != 0) ){
  2007. 		return(1);

tools/tiff2pdf.c:2009:3: 
  2007. 		return(1);
  2008. 	} else {
  2009. 		return(0);
          ^
  2010. 	}
  2011. }

tools/tiff2pdf.c:2011:1: return from a call to t2p_tile_is_bottom_edge
  2009. 		return(0);
  2010. 	}
  2011. }
        ^
  2012. 
  2013. /*

tools/tiff2pdf.c:1944:5: Taking true branch
1942. 	edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
1943. 	
1944. 	if(t2p->pdf_transcode==T2P_TRANSCODE_RAW){
          ^
1945. 		if(edge
1946. #if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)

tools/tiff2pdf.c:1945:6: Taking false branch
1943. 	
1944. 	if(t2p->pdf_transcode==T2P_TRANSCODE_RAW){
1945. 		if(edge
           ^
1946. #if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)
1947. 		&& !(t2p->pdf_compression==T2P_COMPRESS_JPEG)

tools/tiff2pdf.c:1953:4: 
1951. 			return;
1952. 		} else {
1953. 			TIFFGetField(input, TIFFTAG_TILEBYTECOUNTS, &tbc);
         ^
1954. 			t2p->tiff_datasize=tbc[tile];
1955. #ifdef OJPEG_SUPPORT

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:1954:4: 
1952. 		} else {
1953. 			TIFFGetField(input, TIFFTAG_TILEBYTECOUNTS, &tbc);
1954. 			t2p->tiff_datasize=tbc[tile];
         ^
1955. #ifdef OJPEG_SUPPORT
1956. 			if(t2p->tiff_compression==COMPRESSION_OJPEG){

void t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){
	uint64* tbc = NULL;
	uint16 edge=0;
#ifdef JPEG_SUPPORT
	unsigned char* jpt;
#endif
	edge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
	edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
	if(t2p->pdf_transcode==T2P_TRANSCODE_RAW){
		if(edge
#if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)
		&& !(t2p->pdf_compression==T2P_COMPRESS_JPEG)
#endif
		){
			t2p->tiff_datasize=TIFFTileSize(input);
			return;
		} else {
			TIFFGetField(input, TIFFTAG_TILEBYTECOUNTS, &tbc);
			t2p->tiff_datasize=tbc[tile];
#ifdef OJPEG_SUPPORT
			if(t2p->tiff_compression==COMPRESSION_OJPEG){
				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 -= 4;
					}
				}
			}
#endif
			return;
		}
	}
	t2p->tiff_datasize=TIFFTileSize(input);
	if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){
		t2p->tiff_datasize*= t2p->tiff_samplesperpixel;
	}
	return;
}
['void t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){\n\tuint64* tbc = NULL;\n\tuint16 edge=0;\n#ifdef JPEG_SUPPORT\n\tunsigned char* jpt;\n#endif\n\tedge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);\n\tedge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);\n\tif(t2p->pdf_transcode==T2P_TRANSCODE_RAW){\n\t\tif(edge\n#if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)\n\t\t&& !(t2p->pdf_compression==T2P_COMPRESS_JPEG)\n#endif\n\t\t){\n\t\t\tt2p->tiff_datasize=TIFFTileSize(input);\n\t\t\treturn;\n\t\t} else {\n\t\t\tTIFFGetField(input, TIFFTAG_TILEBYTECOUNTS, &tbc);\n\t\t\tt2p->tiff_datasize=tbc[tile];\n#ifdef OJPEG_SUPPORT\n\t\t\tif(t2p->tiff_compression==COMPRESSION_OJPEG){\n\t\t\t\tt2p->tiff_datasize+=2048;\n\t\t\t\treturn;\n\t\t\t}\n#endif\n#ifdef JPEG_SUPPORT\n\t\t\tif(t2p->tiff_compression==COMPRESSION_JPEG) {\n\t\t\t\tuint32 count = 0;\n\t\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt)!=0){\n\t\t\t\t\tif(count > 4){\n\t\t\t\t\t\tt2p->tiff_datasize += count;\n\t\t\t\t\t\tt2p->tiff_datasize -= 4;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n#endif\n\t\t\treturn;\n\t\t}\n\t}\n\tt2p->tiff_datasize=TIFFTileSize(input);\n\tif(t2p->tiff_planar==PLANARCONFIG_SEPARATE){\n\t\tt2p->tiff_datasize*= t2p->tiff_samplesperpixel;\n\t}\n\treturn;\n}', 'int t2p_tile_is_right_edge(T2P_TILES tiles, ttile_t tile){\n\tif( ((tile+1) % tiles.tiles_tilecountx == 0)\n\t\t&& (tiles.tiles_edgetilewidth != 0) ){\n\t\treturn(1);\n\t} else {\n\t\treturn(0);\n\t}\n}', 'int t2p_tile_is_bottom_edge(T2P_TILES tiles, ttile_t tile){\n\tif( ((tile+1) > (tiles.tiles_tilecount-tiles.tiles_tilecountx) )\n\t\t&& (tiles.tiles_edgetilelength != 0) ){\n\t\treturn(1);\n\t} else {\n\t\treturn(0);\n\t}\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}']