tools/tiffcrop.c:7380: error: Null Dereference
  pointer `sect_buff` last assigned on line 7375 could be null and is dereferenced by call to `_TIFFmemset()` at line 7380, column 7.

tools/tiffcrop.c:7352:1: start of procedure createImageSection()
7350. 
7351. /* Create a buffer to write one section at a time */
7352. static int
      ^
7353. createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)
7354.   {

tools/tiffcrop.c:7355:3: 
7353. createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)
7354.   {
7355.   unsigned  char *sect_buff = NULL;
        ^
7356.   unsigned  char *new_buff  = NULL;
7357.   static    uint32  prev_sectsize = 0;

tools/tiffcrop.c:7356:3: 
7354.   {
7355.   unsigned  char *sect_buff = NULL;
7356.   unsigned  char *new_buff  = NULL;
        ^
7357.   static    uint32  prev_sectsize = 0;
7358.   

tools/tiffcrop.c:7357:3: 
7355.   unsigned  char *sect_buff = NULL;
7356.   unsigned  char *new_buff  = NULL;
7357.   static    uint32  prev_sectsize = 0;
        ^
7358.   
7359.   sect_buff = *sect_buff_ptr;

tools/tiffcrop.c:7359:3: 
7357.   static    uint32  prev_sectsize = 0;
7358.   
7359.   sect_buff = *sect_buff_ptr;
        ^
7360. 
7361.   if (!sect_buff)

tools/tiffcrop.c:7361:8: Taking false branch
7359.   sect_buff = *sect_buff_ptr;
7360. 
7361.   if (!sect_buff)
             ^
7362.     {
7363.     sect_buff = (unsigned char *)limitMalloc(sectsize);

tools/tiffcrop.c:7369:9: Taking true branch
7367.   else
7368.     {
7369.     if (prev_sectsize < sectsize)
              ^
7370.       {
7371.       new_buff = _TIFFrealloc(sect_buff, sectsize);

tools/tiffcrop.c:7371:7: 
7369.     if (prev_sectsize < sectsize)
7370.       {
7371.       new_buff = _TIFFrealloc(sect_buff, sectsize);
            ^
7372.       if (!new_buff)
7373.         {

libtiff/tif_unix.c:331:1: start of procedure _TIFFrealloc()
  329. }
  330. 
  331. void*
       ^
  332. _TIFFrealloc(void* p, tmsize_t s)
  333. {

libtiff/tif_unix.c:334:2: 
  332. _TIFFrealloc(void* p, tmsize_t s)
  333. {
  334. 	return (realloc(p, (size_t) s));
        ^
  335. }
  336. 

libtiff/tif_unix.c:335:1: return from a call to _TIFFrealloc
  333. {
  334. 	return (realloc(p, (size_t) s));
  335. }
       ^
  336. 
  337. void

tools/tiffcrop.c:7372:12: Taking true branch
7370.       {
7371.       new_buff = _TIFFrealloc(sect_buff, sectsize);
7372.       if (!new_buff)
                 ^
7373.         {
7374.           _TIFFfree (sect_buff);

tools/tiffcrop.c:7374:11: 
7372.       if (!new_buff)
7373.         {
7374.           _TIFFfree (sect_buff);
                ^
7375.         sect_buff = (unsigned char *)limitMalloc(sectsize);
7376.         }

libtiff/tif_unix.c:325:1: start of procedure _TIFFfree()
  323. }
  324. 
  325. void
       ^
  326. _TIFFfree(void* p)
  327. {

libtiff/tif_unix.c:328:2: 
  326. _TIFFfree(void* p)
  327. {
  328. 	free(p);
        ^
  329. }
  330. 

libtiff/tif_unix.c:329:1: return from a call to _TIFFfree
  327. {
  328. 	free(p);
  329. }
       ^
  330. 
  331. void*

tools/tiffcrop.c:7375:9: 
7373.         {
7374.           _TIFFfree (sect_buff);
7375.         sect_buff = (unsigned char *)limitMalloc(sectsize);
              ^
7376.         }
7377.       else

tools/tiffcrop.c:629:1: start of procedure limitMalloc()
  627.  * This custom malloc function enforce a maximum allocation size
  628.  */
  629. static void* limitMalloc(tmsize_t s)
       ^
  630. {
  631.   if (maxMalloc && (s > maxMalloc)) {

tools/tiffcrop.c:631:7: Taking true branch
  629. static void* limitMalloc(tmsize_t s)
  630. {
  631.   if (maxMalloc && (s > maxMalloc)) {
             ^
  632.     fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n",
  633.             (uint64)s, (uint64)maxMalloc);

tools/tiffcrop.c:631:21: Taking true branch
  629. static void* limitMalloc(tmsize_t s)
  630. {
  631.   if (maxMalloc && (s > maxMalloc)) {
                           ^
  632.     fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n",
  633.             (uint64)s, (uint64)maxMalloc);

tools/tiffcrop.c:632:5: 
  630. {
  631.   if (maxMalloc && (s > maxMalloc)) {
  632.     fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n",
           ^
  633.             (uint64)s, (uint64)maxMalloc);
  634.     fprintf(stderr, "                  use -k option to change limit.\n"); return NULL;

tools/tiffcrop.c:634:5: 
  632.     fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n",
  633.             (uint64)s, (uint64)maxMalloc);
  634.     fprintf(stderr, "                  use -k option to change limit.\n"); return NULL;
           ^
  635.   }
  636.   return _TIFFmalloc(s);

tools/tiffcrop.c:634:76: 
  632.     fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n",
  633.             (uint64)s, (uint64)maxMalloc);
  634.     fprintf(stderr, "                  use -k option to change limit.\n"); return NULL;
                                                                                  ^
  635.   }
  636.   return _TIFFmalloc(s);

tools/tiffcrop.c:637:1: return from a call to limitMalloc
  635.   }
  636.   return _TIFFmalloc(s);
  637. }
       ^
  638. 
  639. 

tools/tiffcrop.c:7380:7: 
7378.         sect_buff = new_buff;
7379. 
7380.       _TIFFmemset(sect_buff, 0, sectsize);
            ^
7381.       }
7382.     }

libtiff/tif_unix.c:337:1: start of procedure _TIFFmemset()
  335. }
  336. 
  337. void
       ^
  338. _TIFFmemset(void* p, int v, tmsize_t c)
  339. {

libtiff/tif_unix.c:340:2: 
  338. _TIFFmemset(void* p, int v, tmsize_t c)
  339. {
  340. 	memset(p, v, (size_t) c);
        ^
  341. }
  342. 

libtiff/tif_unix.c:341:1: return from a call to _TIFFmemset
  339. {
  340. 	memset(p, v, (size_t) c);
  341. }
       ^
  342. 
  343. void

static int
createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)
  {
  unsigned  char *sect_buff = NULL;
  unsigned  char *new_buff  = NULL;
  static    uint32  prev_sectsize = 0;
  sect_buff = *sect_buff_ptr;
  if (!sect_buff)
    {
    sect_buff = (unsigned char *)limitMalloc(sectsize);
    *sect_buff_ptr = sect_buff;
    _TIFFmemset(sect_buff, 0, sectsize);
    }
  else
    {
    if (prev_sectsize < sectsize)
      {
      new_buff = _TIFFrealloc(sect_buff, sectsize);
      if (!new_buff)
        {
          _TIFFfree (sect_buff);
        sect_buff = (unsigned char *)limitMalloc(sectsize);
        }
      else
        sect_buff = new_buff;
      _TIFFmemset(sect_buff, 0, sectsize);
      }
    }
  if (!sect_buff)
    {
    TIFFError("createImageSection", "Unable to allocate/reallocate section buffer");
    return (-1);
    }
  prev_sectsize = sectsize;
  *sect_buff_ptr = sect_buff;
  return (0);
  }
['static int\ncreateImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)\n  {\n  unsigned  char *sect_buff = NULL;\n  unsigned  char *new_buff  = NULL;\n  static    uint32  prev_sectsize = 0;\n  sect_buff = *sect_buff_ptr;\n  if (!sect_buff)\n    {\n    sect_buff = (unsigned char *)limitMalloc(sectsize);\n    *sect_buff_ptr = sect_buff;\n    _TIFFmemset(sect_buff, 0, sectsize);\n    }\n  else\n    {\n    if (prev_sectsize < sectsize)\n      {\n      new_buff = _TIFFrealloc(sect_buff, sectsize);\n      if (!new_buff)\n        {\n          _TIFFfree (sect_buff);\n        sect_buff = (unsigned char *)limitMalloc(sectsize);\n        }\n      else\n        sect_buff = new_buff;\n      _TIFFmemset(sect_buff, 0, sectsize);\n      }\n    }\n  if (!sect_buff)\n    {\n    TIFFError("createImageSection", "Unable to allocate/reallocate section buffer");\n    return (-1);\n    }\n  prev_sectsize = sectsize;\n  *sect_buff_ptr = sect_buff;\n  return (0);\n  }', 'void*\n_TIFFrealloc(void* p, tmsize_t s)\n{\n\treturn (realloc(p, (size_t) s));\n}', 'void\n_TIFFfree(void* p)\n{\n\tfree(p);\n}', 'static void* limitMalloc(tmsize_t s)\n{\n  if (maxMalloc && (s > maxMalloc)) {\n    fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\\n",\n            (uint64)s, (uint64)maxMalloc);\n    fprintf(stderr, "                  use -k option to change limit.\\n"); return NULL;\n  }\n  return _TIFFmalloc(s);\n}', 'void\n_TIFFmemset(void* p, int v, tmsize_t c)\n{\n\tmemset(p, v, (size_t) c);\n}']