buffer overflow detected in SLEUTH in Linux Mint

22 Views Asked by At

I am trying to compile and run SLEUTH urban growth modeling software in Linux Mint using GCC. However, when I try to run the program, which runs under cygwin in Windows, I get the error: buffer overflow detected. I think the problem lies somewhere here in the memory_obj.c file as below: /******************************************************************************


** FUNCTION NAME: mem_MemoryLog
** PURPOSE:       log memory map to FILE* fp
** AUTHOR:        Keith Clarke
** PROGRAMMER:    Tommy E. Cathey of NESC (919)541-1500
** CREATION DATE: 11/11/1999
** DESCRIPTION:
**
**
*/
    void
      mem_MemoryLog (FILE * fp)
    {
      LOG_MEM (fp, &nrows, sizeof (int), 1);
      LOG_MEM (fp, &ncols, sizeof (int), 1);
      LOG_MEM (fp, &total_pixels, sizeof (int), 1);
      LOG_MEM (fp, &invalid_val, sizeof (PIXEL), 1);

      LOG_MEM (fp, &igrid_free[0], sizeof (int), MEM_ARRAY_SIZE);
      LOG_MEM (fp, &igrid_free_tos, sizeof (int), 1);
      LOG_MEM (fp, &igrid_array[0], sizeof (mem_track_info), MEM_ARRAY_SIZE);

      LOG_MEM (fp, &pgrid_free[0], sizeof (int), MEM_ARRAY_SIZE);
      LOG_MEM (fp, &pgrid_free_tos, sizeof (int), 1);
      LOG_MEM (fp, &pgrid_array[0], sizeof (mem_track_info), MEM_ARRAY_SIZE);

      LOG_MEM (fp, &wgrid_free[0], sizeof (int), MEM_ARRAY_SIZE);
      LOG_MEM (fp, &wgrid_free_tos, sizeof (int), 1);
      LOG_MEM (fp, &min_wgrid_free_tos, sizeof (int), 1);
      LOG_MEM (fp, &wgrid_array[0], sizeof (mem_track_info), MEM_ARRAY_SIZE);

      LOG_MEM (fp, &mem_check_count, sizeof (int), 1);
      LOG_MEM (fp, &mem_check_size, sizeof (int), 1);
      LOG_MEM (fp, &igrid_size, sizeof (int), 1);
      LOG_MEM (fp, &pgrid_size, sizeof (int), 1);
      LOG_MEM (fp, &wgrid_size, sizeof (int), 1);

      LOG_MEM (fp, &bytes_p_grid, sizeof (int), 1);
      LOG_MEM (fp, &bytes_p_grid_rounded2wordboundary, sizeof (int), 1);
      LOG_MEM (fp, &bytes_p_packed_grid, sizeof (int), 1);
      LOG_MEM (fp, &bytes_p_packed_grid_rounded2wordboundary, sizeof (int), 1);
      LOG_MEM (fp, &bytes2allocate, sizeof (int), 1);
      LOG_MEM (fp, &mem_ptr, sizeof (void *), 1);
      LOG_MEM (fp, &igrid_count, sizeof (int), 1);
      LOG_MEM (fp, &pgrid_count, sizeof (int), 1);
      LOG_MEM (fp, &wgrid_count, sizeof (int), 1);
      LOG_MEM (fp, &memlog_fp, sizeof (FILE *), 1);
    }

could you please help?

I tried to run the software in linux mint and expected it to run as it did with cygwin in Windows.

0

There are 0 best solutions below