Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] i.vi: segmentation fault with non-existing input map(s) #1349

Closed
neteler opened this issue Feb 16, 2021 · 0 comments · Fixed by #1353
Closed

[Bug] i.vi: segmentation fault with non-existing input map(s) #1349

neteler opened this issue Feb 16, 2021 · 0 comments · Fixed by #1353
Labels
bug Something isn't working
Milestone

Comments

@neteler
Copy link
Member

neteler commented Feb 16, 2021

Describe the bug

When using i.vi with non-existing input map(s) it segfaults:

# works
GRASS nc_spm_08_grass7/user1:~ > g.region raster=lsat7_2002_30

GRASS nc_spm_08_grass7/user1:~ > i.vi red=lsat7_2002_30 nir=lsat7_2002_40 viname=ndvi output=lsat7_2002.ndvi
 100%

# fails
GRASS nc_spm_08_grass7/user1:~ > i.vi green=not_there nir=non_existing viname=ndwi output=ndwi
Segmentation fault (core dumped)

To Reproduce

GRASS nc_spm_08_grass7/user1:~ > gdb i.vi
GNU gdb (GDB) Fedora 10.1-2.fc33
...
Reading symbols from i.vi...
(gdb) r green=not_there nir=non_existing viname=ndwi output=ndwi
Starting program: /home/mneteler/software/grass_master/dist.x86_64-pc-linux-gnu/bin/i.vi green=not_there nir=non_existing viname=ndwi output=ndwi
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.32-4.fc33.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f5720d in G_name_is_fully_qualified (fullname=0x0, name=0x7fffffffc680 "", mapset=0x7fffffffc780 "")
    at nme_in_mps.c:45
45	    for (p = fullname; *p; p++)
Missing separate debuginfos, use: dnf debuginfo-install SuperLU-5.2.1-14.fc33.x86_64 armadillo-10.2.0-1.fc33.x86_64
...
(gdb) bt full
#0  0x00007ffff7f5720d in G_name_is_fully_qualified (fullname=0x0, name=0x7fffffffc680 "", mapset=0x7fffffffc780 "")
    at nme_in_mps.c:45
        p = 0x0
        q = 0x7ffff7faea56 <init+613> "\307\005\030\240\001"
#1  0x00007ffff7f573a9 in G_unqualified_name (name=0x0, mapset=0x406bcf "", xname=0x7fffffffc680 "", xmapset=0x7fffffffc780 "")
    at nme_in_mps.c:137
No locals.
#2  0x00007ffff7fb0718 in Rast__open_old (name=0x0, mapset=0x406bcf "") at open.c:172
        fcb = 0x480ab0
        cell_fd = 32767
        fd = 48
        cell_dir = 0x7fffffffc780 ""
        r_name = 0x7fffffffc6b0 "\340\334G"
        r_mapset = 0x7ffffbad8001 <error: Cannot access memory at address 0x7ffffbad8001>
        cellhd = {format = 0, compressed = 0, rows = 338460416, rows3 = -2097709812, cols = 0, cols3 = 0, depths = 0, proj = 0, 
          zone = 4710752, ew_res = 2.3242428990438929e-317, ew_res3 = 0, ns_res = 2.3274207292779438e-317, 
          ns_res3 = 3.4090529563046012e-322, tb_res = 6.9533489704878039e-310, north = -nan(0xfffff00000000), 
          south = 6.9533558071203878e-310, east = 2.3268752808049351e-317, west = 6.9533490506244612e-310, top = 0, bottom = 0}
        CELL_nbytes = 0
        INTERN_SIZE = 16
        reclass_flag = 4721272
        MAP_NBYTES = 32767
        MAP_TYPE = 0
        reclass = {name = 0x480ab0 "8", mapset = 0x480ab0 "8", type = 4721152, num = 0, min = 4721328, max = 0, table = 0x480ab1}
        xname = "\000\310G\000\000\000\000\000\340\023\331\367", '\000' <repeats 12 times>, "\220\307\377\377\377\177\000\000\020\335G\000\000\000\000\000\200\307\377\377\377\177\000\000\340\334G\000\000\000\000\000\200\307\377\377\377\177\000\000\070\310\377\377\377\177\000\000\340\334G\000\000\000\000\000\001", '\000' <repeats 15 times>, "@\336G\000\000\000\000\000\220\307\377\377\377\177\000\000\020\335G\000\000\000\000\000G3\300\367\377\177\000\000\000\000\000\000\000\000\000\000S\364\367\367\377\177\000\000b\364\367\367\377\177\000\000\326\307\377\377\377\177\000\000\060\310\377\377\377\177\000\000\224\274\365\367\377\177", '\000' <repeats 11 times>, "\177,\024\f}\367\202\000\000\000\000\000\000\000\000"...
        xmapset = "\000\000_US\000\000\000\344\250\300\367\377\177\000\000LC_MESSA\260\345G\000\000\000\000\000\340\307\377\377\377\177\000\000\360a@\000\000\000\000\000\030b@\000\000\000\000\000\260\361\370\367\377\177\000\000\340\307\377\377\377\177\000\000{E\367\367\377\177\000\000\na@", '\000' <repeats 13 times>, "\340\310\377\377\377\177\000\000%\233\362\367\377\177\000\000\000\000\000\000\000\000\000\000Qh@", '\000' <repeats 17 times>, "\005\000\000\000\220\307\377\377\377\177\000\000\000\000\000\000\377\177\000\000\020\335G\000\000\000\000\000\060\vH\000\000\000\000\000Qh@\000\000\000\000\000\002\000\000\000\000\000\000\000 \025\331\367\377\177\000\000\000\000\000\000\000\000\000\000"...
        gdal = 0x480ab1
        vrt = 0x480ab1
#3  0x00007ffff7fb06a8 in Rast_open_old (name=0x0, mapset=0x406bcf "") at open.c:114
        fd = 0
#4  0x00000000004039de in main (argc=5, argv=0x7fffffffcd38) at main.c:294
        nrows = 0
        ncols = 4695936
        row = 0
        col = 17
        viflag = 0x480b30 "ndwi"
        desc = 0x47fc40 "arvi;Atmospherically Resistant Vegetation Index;dvi;Difference Vegetation Index;evi;Enhanced Vegetation Index;evi2;Enhanced Vegetation Index 2;gvi;Green Vegetation Index;gari;Green Atmospherically Res"...
        module = 0x7ffff7f8ef08 <state+40>
        opt = {viname = 0x47e0a0, red = 0x47eb20, nir = 0x47ebc0, green = 0x47ec80, blue = 0x47ed40, chan5 = 0x47e1f0, 
          chan7 = 0x47e2b0, sl_slope = 0x47e370, sl_int = 0x47e430, sl_red = 0x47e4f0, bits = 0x47e5b0, 
          output = 0x7ffff7f8ef68 <state+136>}
        history = {fields = {0x46 <error: Cannot access memory at address 0x46>, 0x47a7c0 "nc_spm_08_grass7", 
            0x13 <error: Cannot access memory at address 0x13>, 0x13 <error: Cannot access memory at address 0x13>, 0x0, 
            0x47 <error: Cannot access memory at address 0x47>, 0x7fffffffcaa0 "VP ENT HDR", 
            0xa <error: Cannot access memory at address 0xa>}, nlines = 1159745622, lines = 0x5244}
        colors = {version = -136775072, shift = 5.6619923013406854e-321, invert = 0, is_float = 0, null_set = 32, 
          null_red = 0 '\000', null_grn = 0 '\000', null_blu = 0 '\000', undef_set = -13504, undef_red = 255 '\377', 
          undef_grn = 127 '\177', undef_blu = 0 '\000', fixed = {rules = 0x7ffff7d8fa00 <main_arena>, n_rules = 1056, lookup = {
              red = 0x410 <error: Cannot access memory at address 0x410>, 
              grn = 0x42 <error: Cannot access memory at address 0x42>, blu = 0x6e <error: Cannot access memory at address 0x6e>, 
              set = 0x77 <error: Cannot access memory at address 0x77>, nalloc = -138057399, active = 32767}, fp_lookup = {
              vals = 0x1b, rules = 0x1, nalloc = 64, active = 0}, min = 3.4584595208887258e-323, max = 0}, modular = {
            rules = 0x410, n_rules = 64, lookup = {red = 0x50 <error: Cannot access memory at address 0x50>, 
              grn = 0x440 <error: Cannot access memory at address 0x440>, 
              blu = 0x10 <error: Cannot access memory at address 0x10>, 
              set = 0x4000000042 <error: Cannot access memory at address 0x4000000042>, nalloc = 0, active = 0}, fp_lookup = {
              vals = 0x0, rules = 0x2, nalloc = 93, active = 119}, min = 2.6312747813404099e-312, max = 3.9525251667299724e-322}, 
          cmin = 3.7967956751608114e-319, cmax = 6.953349050243833e-310, organizing = 4216189}
        result = 0x480b50 "ndwi"
        infd_redchan = 0
        infd_nirchan = 0
        infd_greenchan = 17
        infd_bluechan = 0
        infd_chan5chan = 0
        infd_chan7chan = 0
        outfd = 0
        bluechan = 0x0
        greenchan = 0x480a00 "not_there"
        redchan = 0x0
        nirchan = 0x480b10 "non_existing"
        chan5chan = 0x0
        chan7chan = 0x0
        inrast_redchan = 0x8
        inrast_nirchan = 0x11
        inrast_greenchan = 0x0
        inrast_bluechan = 0x43
        inrast_chan5chan = 0x7fffffffca00
        inrast_chan7chan = 0x5
        outrast = 0x454c5954534d4944
        data_type_redchan = 66
        data_type_nirchan = 65
        data_type_greenchan = 0
        data_type_bluechan = -13904
        data_type_chan5chan = 32767
        data_type_chan7chan = 5
        msavip1 = 0
        msavip2 = 2.22601511e+11
        msavip3 = 1.17709071e-43
        dnbits = 8
        val1 = 0
        val2 = 4695904

Expected behavior

The module should print a fatal error that the map isn't there and end.

System description (please complete the following information):

  • Fedora 33
  • GRASS GIS 7.8 and 7.9
g.version -rge
version=7.9.dev
date=2021
revision=3a50170e7
build_date=2021-02-16
build_platform=x86_64-pc-linux-gnu
build_off_t_size=8
libgis_revision=d79d6ff90
libgis_date=2021-02-13T16:23:10+00:00
proj=6.3.2
gdal=3.1.4
geos=3.8.1
sqlite=3.34.1

Additional context
Add any other context about the problem here.

@neteler neteler added the bug Something isn't working label Feb 16, 2021
@neteler neteler added this to the 7.8.6 milestone Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant