Opened 15 years ago

Closed 15 years ago

#477 closed defect (fixed)

d.vect: segfault if zcolor= does not exist

Reported by: hamish Owned by: martinl
Priority: major Milestone: 6.4.0
Component: Default Version: svn-develbranch6
Keywords: d.vect Cc: grass-dev@…
CPU: x86-32 Platform: Linux

Description

Hi,

a typo causes a segfault in d.vect:

v.random -z out=rand2k n=2000 zmax=1000
d.vect -z rand2k zcolor=bcry
Segmentation fault

(should have been zcolor=bcyr)

Hamish

Change History (3)

comment:1 by neteler, 15 years ago

Same here:

GRASS 6.5.svn (spearfish60):~ > gdb d.vect      
GNU gdb 6.8-2mdv2009.0 (Mandriva Linux release 2009.0)
This GDB was configured as "x86_64-mandriva-linux-gnu"...                    
(gdb) r -z rand2k zcolor=bcry
Starting program: /home/neteler/grass64/dist.x86_64-unknown-linux-gnu/bin/d.vect -z rand2k zcolor=bcry                                                                              

Program received signal SIGSEGV, Segmentation fault.
0x00007f0f1a91d045 in G__lookup_colors (raster=0x7fff22f94d88, red=0x7fff22f94bbf "", 
    grn=0x7fff22f94bbe "", blu=0x7fff22f94bbd "\177", set=0x7fff22f94bbc "", n=0,     
    colors=0x7fff22f94c50, mod=0, rules_only=0, data_type=2) at color_look.c:416      
416                     if (rule->low.value <= val && val <= rule->high.value)        



(gdb) bt full                                                                             
#0  0x00007f0f1a91d045 in G__lookup_colors (raster=0x7fff22f94d88,                        
    red=0x7fff22f94bbf "", grn=0x7fff22f94bbe "", blu=0x7fff22f94bbd "\177",              
    set=0x7fff22f94bbc "", n=0, colors=0x7fff22f94c50, mod=0, rules_only=0, data_type=2)  
    at color_look.c:416                                                                   
        cp = (struct _Color_Info_ *) 0x7fff22f94c78                                       
        rule = (struct _Color_Rule_ *) 0x4                                                
        dmin = 0                                                                          
        dmax = 4.9406564584124654e-324                                                    
        val = 760.15708444647362                                                          
        dmod = 0                                                                          
        shift = 6.9022378534570414e-310                                                   
        cat = 760                                                                         
        min = 0                                                                           
        max = 1                                                                           
        ptr = (const void *) 0x7fff22f94d88                                               
        last_ptr = (const void *) 0x7fff22f94d88                                          
        invert = 0                                                                        
        found = 0                                                                         
        r = 1075052544                                                                    
        g = 0                                                                             
        b = 0                                                                             
        cell_type = 0                                                                     
        lookup = 32527                                                                    
        max_ind = 32767                                                                   
        min_ind = 1                                                                       
        try = 0                                                                           
        lower = (int (*)()) 0x7f0f1af94000                                                
#1  0x00007f0f1a91c7e3 in G_lookup_raster_colors (raster=0x7fff22f94d88,                  
    red=0x7fff22f94bbf "", grn=0x7fff22f94bbe "", blu=0x7fff22f94bbd "\177",              
    set=0x7fff22f94bbc "", n=1, colors=0x7fff22f94c50, map_type=2) at color_look.c:129    
No locals.                                                                                
#2  0x00007f0f1a91b7be in G_get_raster_color (rast=0x7fff22f94d88, red=0x7fff22f94d9c,    
    grn=0x7fff22f94d98, blu=0x7fff22f94d94, colors=0x7fff22f94c50, map_type=2)            
    at color_get.c:73                                                                     
        r = 0 '\0'                                                                        
        g = 0 '\0'                                                                        
        b = 127 '\177'                                                                    
        set = 0 '\0'                                                                      
#3  0x0000000000408eba in plot1 (Map=0x7fff22f950a0, type=31, area=1, Clist=0x16f1d00,    
    color=0x7fff22f95790, fcolor=0x7fff22f95780, chcat=0, Symb=0x16f1950, size=5,         
    id_flag=0, table_colors_flag=0, cats_color_flag=0, rgb_column=0x40b06f "GRASSRGB",    
    default_width=0, width_column=0x0, width_scale=1, z_color_flag=1,                     
    style=0x16f0100 "bcry") at plot1.c:352                                                
        box = {N = 4927995.8685351424, S = 4914025.9408193855, E = 608987.78504378523,    
  W = 590020.3261818412, T = 999.87120460712879, B = 0.27088681248523611}                 
        zval = 760.15708444647362                                                         
        colors = {version = 439190624, shift = 6.9022378534570414e-310, invert = 0,       
  is_float = 1, null_set = 128, null_red = 1 '\001', null_grn = 0 '\0',                   
  null_blu = 0 '\0', undef_set = 452548376, undef_red = 15 '\017',                        
  undef_grn = 127 '\177', undef_blu = 0 '\0', fixed = {rules = 0x7f0f1af95a70,            
    n_rules = 586763760, lookup = {red = 0x7fff22f94db8 "",                               
      grn = 0xc8bfb91d <Address 0xc8bfb91d out of bounds>,                                
      blu = 0x7fff22f94da0 "�t-\032\017\177", set = 0x0, nalloc = 450388310,              
      active = 32527}, fp_lookup = {vals = 0x0, rules = 0x0, nalloc = 1, active = 0},     
    min = 0, max = 4.9406564584124654e-324}, modular = {rules = 0x7f0f1ad86156,           
    n_rules = 0, lookup = {red = 0x0,                                                     
      grn = 0x100000001 <Address 0x100000001 out of bounds>, blu = 0x0,                   
      set = 0x7f0f1af95a70 "�b�\032\017\177", nalloc = 586763808, active = 32767},        
    fp_lookup = {vals = 0x7f0f1af95718, rules = 0x7f0f1ab71aac, nalloc = 448205368,       
      active = 1}, min = 0, max = 6.9022380682882465e-310},                               
  cmin = 6.9531725982422549e-310, cmax = 6.9022380682459545e-310}                         
        i = 0                                                                             
        ltype = 1                                                                         
        nlines = 2000                                                                     
        line = 1                                                                          
        cat = -1                                                                          
        x = (double *) 0x7fff00000001                                                     
        y = (double *) 0x7f0f1a2ddc1a                                                     
        Points = (struct line_pnts *) 0x1778530                                           
        PPoints = (struct line_pnts *) 0x1778500                                          
        Cats = (struct line_cats *) 0x16f3870                                             
        msize = 148.359375                                                                
        x0 = 439212960                                                                    
        y0 = 32767                                                                        
        fi = (struct field_info *) 0x0                                                    
        driver = (dbDriver *) 0x0                                                         
        cvarr_rgb = {n_values = 0, alloc = 0, ctype = 0, value = 0x7f0f1ab70000}          
        cvarr_width = {n_values = 0, alloc = 0, ctype = 0, value = 0x0}                   
        cv_rgb = (dbCatVal *) 0x0                                                         
        cv_width = (dbCatVal *) 0x0                                                       
        nrec_rgb = 0                                                                      
        nrec_width = 0                                                                    
        nerror_rgb = 0                                                                    
        open_db = 0                                                                       
        custom_rgb = 1                                                                    
        colorstring = "�t-\032\017\177\000\000\000��\032"                                 
        red = 32527                                                                       
        grn = 452542464                                                                   
        blu = 32527                                                                       
        line_color = (RGBA_Color *) 0x16ec510                                             
        fill_color = (RGBA_Color *) 0x1778560                                             
        primary_color = (RGBA_Color *) 0x1778580                                          
        which = 0 '\0'                                                                    
        width = 0                                                                         
#4  0x0000000000407fc6 in main (argc=4, argv=0x7fff22f95a38) at main.c:687                
        mapset = 0x16f1bc0 "neteler"                                                      
        ret = 1                                                                           
        level = 2                                                                         
        i = 1                                                                             
        stat = 0                                                                          
        type = 31                                                                         
        area = 1                                                                          
        display = 1                                                                       
        chcat = 0                                                                         
        r = 255                                                                           
        g = 0                                                                             
        b = 0                                                                             
        has_color = 1                                                                     
        has_fcolor = 1                                                                    
        color = {r = 0 '\0', g = 0 '\0', b = 0 '\0'}                                      
        fcolor = {r = 200 '�', g = 200 '�', b = 200 '�'}                                  
        size = 5                                                                          
        default_width = 0                                                                 
        width_scale = 1                                                                   
        verbose = 0                                                                       
        minreg = 2.0739729580117178e-317                                                  
        maxreg = 2.1219957909652723e-314                                                  
        reg = 16485                                                                       
        map_name = "rand2k\000\000$_�\032\017\177\000\000�e�\027\017\177\000\000\016\000\000\000\017\177\000\000\214�>\003\000\000\000\000@W�\"�\177\000\000�X�\"�\177\000\000\b��\027\017\177", '\0' <repeats 18 times>, "0��\032\017\177\000\000�Z�\032\017\177\000\000X?�\027\017\177\000\000\230\t�\032\017\177\000\000\025\000\000\000\000\000\000\0002\000\000\000\000\000\000"                                                                             
        module = (struct GModule *) 0x7f0f1ab6af40                                        
        map_opt = (struct Option *) 0x7f0f1ab6aea0                                        
        color_opt = (struct Option *) 0x16ee730                                           
        fcolor_opt = (struct Option *) 0x16ee800                                          
        rgbcol_opt = (struct Option *) 0x16ee8d0                                          
        zcol_opt = (struct Option *) 0x16ee9a0                                            
        type_opt = (struct Option *) 0x16ee3f0                                            
        display_opt = (struct Option *) 0x16ee320                                         
        icon_opt = (struct Option *) 0x16eece0                                            
        size_opt = (struct Option *) 0x16eedb0                                            
        where_opt = (struct Option *) 0x16ee660                                           
        field_opt = (struct Option *) 0x16ee4c0                                           
        cat_opt = (struct Option *) 0x16ee590                                             
        lfield_opt = (struct Option *) 0x16eee80                                          
        lcolor_opt = (struct Option *) 0x16ef020                                          
        bgcolor_opt = (struct Option *) 0x16ef0f0                                         
        bcolor_opt = (struct Option *) 0x16ef1c0                                          
        lsize_opt = (struct Option *) 0x16ef290                                           
        font_opt = (struct Option *) 0x16ef360                                            
        xref_opt = (struct Option *) 0x16ef430                                            
        yref_opt = (struct Option *) 0x16ef500                                            
        attrcol_opt = (struct Option *) 0x16eef50                                         
        maxreg_opt = (struct Option *) 0x16ef6a0                                          
        minreg_opt = (struct Option *) 0x16ef5d0                                          
        width_opt = (struct Option *) 0x16eea70                                           
        wcolumn_opt = (struct Option *) 0x16eeb40                                         
        wscale_opt = (struct Option *) 0x16eec10                                          
        render_opt = (struct Option *) 0x16ef770                                          
        verbose_flag = (struct Flag *) 0x7f0f1ab6ae60                                     
        id_flag = (struct Flag *) 0x16ef950                                               
        table_acolors_flag = (struct Flag *) 0x16ef870                                    
        cats_acolors_flag = (struct Flag *) 0x16ef8e0                                     
        x_flag = (struct Flag *) 0x16ef9c0                                                
        zcol_flag = (struct Flag *) 0x16efa30                                             
        Clist = (struct cat_list *) 0x16f1d00                                             
        cats = (int *) 0x32                                                               
        ncat = 0                                                                          
        lattr = {field = 1, has_bgcolor = 0, has_bcolor = 0, color = {R = 255 '�',        
    G = 0 '\0', B = 0 '\0'}, bgcolor = {R = 0 '\0', G = 25 '\031', B = 0 '\0'},           
  bcolor = {R = 0 '\0', G = 0 '\0', B = 0 '\0'}, size = 8, font = 0x0, xref = 1,          
  yref = 0}                                                                               
        Map = {format = 0, temporary = 32527, dblnk = 0x16f3650, plus = {                 
    Version_Major = 5, Version_Minor = 0, Back_Major = 5, Back_Minor = 0,                 
    spidx_Version_Major = 1146486784, spidx_Version_Minor = -31574607,                    
    spidx_Back_Major = 537133092, spidx_Back_Minor = 1477443664, cidx_Version_Major = 5,  
    cidx_Version_Minor = 0, cidx_Back_Major = 5, cidx_Back_Minor = 0, with_z = 1,         
    spidx_with_z = 1065098, head_size = 142, spidx_head_size = -4025935812351719360,      
    cidx_head_size = 9, release_support = 0, port = {byte_order = 0,                      
      dbl_cnvrt = "\000\001\002\003\004\005\006\a", flt_cnvrt = "\000\001\002\003",       
      lng_cnvrt = "\000\001\002\003", int_cnvrt = "\000\001\002\003",                     
      shrt_cnvrt = "\000\001", dbl_quick = 1, flt_quick = 1, lng_quick = 1,               
      int_quick = 1, shrt_quick = 1}, spidx_port = {byte_order = 0,                       
      dbl_cnvrt = "\220W�\"�\177\000", flt_cnvrt = "\000X�\"", lng_cnvrt = "�\177\000",   
      int_cnvrt = "\000\000\000", shrt_cnvrt = "\000", dbl_quick = 6341968,               
      flt_quick = 0, lng_quick = 0, int_quick = 0, shrt_quick = 452372992}, cidx_port = { 
      byte_order = 0, dbl_cnvrt = "\000\001\002\003\004\005\006\a",                       
      flt_cnvrt = "\000\001\002\003", lng_cnvrt = "\000\001\002\003",                     
      int_cnvrt = "\000\001\002\003", shrt_cnvrt = "\000\001", dbl_quick = 1,             
      flt_quick = 1, lng_quick = 1, int_quick = 1, shrt_quick = 1}, mode = 0, built = 4,  
    box = {N = 4927995.8685351424, S = 4914025.9408193855, E = 608987.78504378523,        
      W = 590020.3261818412, T = 999.87120460712879, B = 0.27088681248523611},            
    Node = 0x16f4340, Line = 0x1736980, Area = 0x1769620, Isle = 0x1769640,               
    n_nodes = 2000, n_edges = 0, n_lines = 2000, n_areas = 0, n_isles = 0,                
    n_volumes = 0, n_holes = 0, n_plines = 2000, n_llines = 0, n_blines = 0,              
    n_clines = 0, n_flines = 0, n_klines = 0, alloc_nodes = 2000, alloc_edges = 0,        
    alloc_lines = 2000, alloc_areas = 0, alloc_isles = 0, alloc_volumes = 0,              
    alloc_holes = 0, Node_offset = 142, Edge_offset = 0, Line_offset = 80142,             
    Area_offset = 98142, Isle_offset = 98142, Volume_offset = 0, Hole_offset = 0,         
    Spidx_built = 0, Node_spidx_offset = 0, Edge_spidx_offset = 0,                        
    Line_spidx_offset = 0, Area_spidx_offset = 0, Isle_spidx_offset = 0,                  
    Volume_spidx_offset = 0, Hole_spidx_offset = 0, Node_spidx = 0x16f3910,               
    Line_spidx = 0x16f3b20, Area_spidx = 0x16f3d30, Isle_spidx = 0x16f3f40,               
    update_cidx = 0, n_cidx = 1, a_cidx = 1, cidx = 0x1769aa0, cidx_up_to_date = 1,       
    coor_size = 74014, coor_mtime = 140733780153024, do_uplist = 0, uplines = 0x401cf6,   
    alloc_uplines = 450398823, n_uplines = 32527, upnodes = 0x7f0f00000001,               
    alloc_upnodes = 452375856, n_upnodes = 32527}, graph_line_type = 586765040, graph = { 
    iErrno = 0, Version = 0 '\0', Endian = 0 '\0', NodeAttrSize = 4201700,                
    EdgeAttrSize = 139702851635815, aOpaqueSet = {139702401236993, 139702853611520,       
      140733780153120, 0, 4201682, 139702851635815, 139702401236993, 139702853618248,     
      140733780153168, 0, 4201665, 139702851635815, 139702401236993, 139702853616936,     
      140733780153216, 0}, cNode = 4201649, cHead = 139702851635815,                      
    cTail = 139702401236993, cAlone = 139702853615616, cEdge = 140733780153264,           
    nnCost = 0, Flags = 4201538, nFamily = 139702851635815, nOptions = 139702401236993,   
    pNodeTree = 0x7f0f1af6da60, pEdgeTree = 0x7fff22f953e0, pNodeBuffer = 0x0,            
    iNodeBuffer = 4201417,                                                                
    pEdgeBuffer = 0x7f0f1ad88a67 "H\213]�A\211�H\205�\017\205�\006",                      
    iEdgeBuffer = 139702401236993, edgePrioritizer = {cEdge = 452384048, iEdge = 32527,   
      pEdgePri32Item = 0x7fff22f95410, pvAVL = 0x0}, nodePrioritizer = {                  
      pvAVL = 0x4017fa}}, spCache = {nStartNode = 139702851635815, NodeHeap = {           
      index = 139702401236993, count = 139702853619712, block = 140733780153408,          
      pnode = 0x0}, pvVisited = 0x4017e5, pvPredist = 0x7f0f1ad88a67},                    
  edge_fcosts = 0x7f0f00000001, edge_bcosts = 0x7f0f1af6e990,                             
  node_costs = 0x7fff22f95470, cost_multip = 0, open = 1428335138, mode = 0, level = 2,   
  head_only = 0, support_updated = 0, next_line = 1, name = 0x16f3510 "rand2k",           
  mapset = 0x16f35a0 "neteler", location = 0x16f35c0 "spearfish60",                       
  gisdbase = 0x16f3550 "/home/neteler/grassdata", Constraint_region_flag = 0,             
  Constraint_type_flag = 0, Constraint_N = 6.902235187052339e-310,                        
  Constraint_S = 6.9022157092730871e-310, Constraint_E = 1.6136390512615074e-316,         
  Constraint_W = 6.9531725983292104e-310, Constraint_T = 6.9531725983485778e-310,         
  Constraint_B = 6.9022351870551057e-310, Constraint_type = 0, proj = 0, dig_fp = {       
    file = 0x1769660, start = 0x0, current = 0x0, end = 0x0, size = 0, alloc = 0,         
    loaded = 0}, head = {organization = 0x16f1d30 "", date = 0x16f1d50 "",                
    your_name = 0x16f1d70 "neteler", map_name = 0x16f1d90 "",                             
    source_date = 0x16f23e0 "Thu Feb  5 09:16:03 2009", orig_scale = 1,                   
    line_3 = 0x16f3630 "", plani_zone = 0, digit_thresh = 0, Version_Major = 5,           
    Version_Minor = 1, Back_Major = 5, Back_Minor = 1, with_z = 1, size = 74014,          
    head_size = 14, port = {byte_order = 0,                                               
      dbl_cnvrt = "\000\001\002\003\004\005\006\a", flt_cnvrt = "\000\001\002\003",       
      lng_cnvrt = "\000\001\002\003", int_cnvrt = "\000\001\002\003",                     
      shrt_cnvrt = "\000\001", dbl_quick = 1, flt_quick = 1, lng_quick = 1,               
      int_quick = 1, shrt_quick = 1}, last_offset = 14, recycle = 0x7f0f0000002e,         
    Map = 0x16bbcde}, fInfo = {i = 586765888, ogr = {dsn = 0x7fff22f957c8 "\001",         
      layer_name = 0x7f0f1ad85aa8 "\205�t\036A\213D$\f\205�u\023\205�\220u\016fE\205�f\220y\bf\017\037D", ds = 0x0, layer = 0x7f0f1ad85aa8, lines = 0x22,                           
      lines_types = 0x7f0f1ad85aa8, lines_alloc = 34, lines_num = 0,                      
      lines_next = 452332032, feature_cache = 0x22, feature_cache_id = 452331976,         
      offset = 0x1b, offset_num = 50, offset_alloc = 0, next_line = -1245593804}},
  hist_fp = 0x176f8e0, site_att = 0x1b, n_site_att = 452331992, n_site_dbl = 32527,
  n_site_str = 29}
        fi = (struct field_info *) 0x4
        driver = (dbDriver *) 0x40a6b5
        handle = {dbName = {string = 0x7f0f1af94a18 "", nalloc = 452543776}, dbSchema = {
    string = 0x7f0f1af6e990 "", nalloc = 452373112}}
        window = {format = 0, compressed = -1, rows = 1398, rows3 = 1398, cols = 1899,
  cols3 = 1899, depths = 1, proj = 1, zone = 13, ew_res = 10, ew_res3 = 10, ns_res = 10,
  ns_res3 = 10, tb_res = 1, north = 4928000, south = 4914020, east = 609000,
  west = 590010, top = 1, bottom = 0}
        box = {N = 4927995.8685351424, S = 4914025.9408193855, E = 608987.78504378523,
  W = 590020.3261818412, T = 999.87120460712879, B = 0.27088681248523611}
        overlap = 1
        Symb = (SYMBOL *) 0x16f1950

comment:2 by martinl, 15 years ago

Cc: grass-dev@… added
Owner: changed from grass-dev@… to martinl
Status: newassigned

Fixed in devbr6, r38367. Any objections to backport it to relbr64?

Martin

in reply to:  2 comment:3 by martinl, 15 years ago

Resolution: fixed
Status: assignedclosed

Replying to martinl:

Fixed in devbr6, r38367. Any objections to backport it to relbr64?

Already done by Markus in r38570. Closing the ticket.

Martin

Note: See TracTickets for help on using tickets.