Skip to content

setting coordinatesyes == 3 causes segfault #4

@lyguy

Description

@lyguy

When last two lines of input.dat are:

%******* 18.) OUTPUT STAKES **************************************
3     %1=stake locations given in local coordinates (x,y), 2=as 1 but center, 3=row/col  coordinatesyes
   102 125

degree.o exits with

segmentation fault 11.

We find with gbd that:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x018b1c70
0x00012028 in startoutascii () at initial.c:990
990 fprintf(outgrid[i],"%s elevation = %5.0f m slope = %5.1f aspect = %5.1f",
(gdb) p stnrow[i]
$1 = 537687
(gdb) p stncol[i]
$2 = 6473500
(gdb) p griddgm[stnrow[i]][stncol[i]]
Cannot access memory at address 0x18b1c70

Looks like strnrow and strncol are being assigned incorrect values somewhere.

Compare:
input.dat:

%******* 18.) OUTPUT STAKES **************************************
1     %1=stake locations given in local coordinates (x,y), 2=as 1 but center, 3=row/col  coordinatesyes
   537687 6473500

Breakpoint 1, startoutascii () at initial.c:990
990 fprintf(outgrid[i],"%s elevation = %5.0f m slope = %5.1f aspect = %5.1f",
(gdb) p stncol[i]
$1 = 101
(gdb) p stnrow[i]
$2 = 80

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions