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

tools/tiff2pdf.c:1937:1: start of procedure t2p_read_tiff_size_tile()
1935. */
1936. 
1937. void t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){
      ^
1938. 
1939. 	uint64* tbc = NULL;

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

tools/tiff2pdf.c:1940:2: 
1938. 
1939. 	uint64* tbc = NULL;
1940. 	uint16 edge=0;
       ^
1941. #ifdef JPEG_SUPPORT
1942. 	unsigned char* jpt;

tools/tiff2pdf.c:1945:2: 
1943. #endif
1944. 
1945. 	edge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
       ^
1946. 	edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
1947. 	

tools/tiff2pdf.c:1992:1: start of procedure t2p_tile_is_right_edge()
  1990.  */
  1991. 
  1992. int t2p_tile_is_right_edge(T2P_TILES tiles, ttile_t tile){
        ^
  1993. 
  1994. 	if( ((tile+1) % tiles.tiles_tilecountx == 0) 

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

tools/tiff2pdf.c:1998:3: 
  1996. 		return(1);
  1997. 	} else {
  1998. 		return(0);
          ^
  1999. 	}
  2000. }

tools/tiff2pdf.c:2000:1: return from a call to t2p_tile_is_right_edge
  1998. 		return(0);
  1999. 	}
  2000. }
        ^
  2001. 
  2002. /*

tools/tiff2pdf.c:1946:2: 
1944. 
1945. 	edge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
1946. 	edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
       ^
1947. 	
1948. 	if(t2p->pdf_transcode==T2P_TRANSCODE_RAW){

tools/tiff2pdf.c:2007:1: start of procedure t2p_tile_is_bottom_edge()
  2005.  */
  2006. 
  2007. int t2p_tile_is_bottom_edge(T2P_TILES tiles, ttile_t tile){
        ^
  2008. 
  2009. 	if( ((tile+1) > (tiles.tiles_tilecount-tiles.tiles_tilecountx) )

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

tools/tiff2pdf.c:2013:3: 
  2011. 		return(1);
  2012. 	} else {
  2013. 		return(0);
          ^
  2014. 	}
  2015. }

tools/tiff2pdf.c:2015:1: return from a call to t2p_tile_is_bottom_edge
  2013. 		return(0);
  2014. 	}
  2015. }
        ^
  2016. 
  2017. /*

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

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

tools/tiff2pdf.c:1957:4: 
1955. 			return;
1956. 		} else {
1957. 			TIFFGetField(input, TIFFTAG_TILEBYTECOUNTS, &tbc);
         ^
1958. 			t2p->tiff_datasize=(tmsize_t)tbc[tile];
1959. #ifdef OJPEG_SUPPORT

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:1958:4: 
1956. 		} else {
1957. 			TIFFGetField(input, TIFFTAG_TILEBYTECOUNTS, &tbc);
1958. 			t2p->tiff_datasize=(tmsize_t)tbc[tile];
         ^
1959. #ifdef OJPEG_SUPPORT
1960. 			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=(tmsize_t)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=(tmsize_t)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}']