Opened 10 years ago

Closed 10 years ago

#526 closed defect/bug (fixed)

[MG] Broken by changesets 2859 + 2861

Reported by: pini Owned by: cp15
Priority: blocker Milestone:
Component: mapdrivers/M&G Version: git master
Severity: Keywords:
Cc:

Description

Hi,

Using navit from svn2865 with MG maps and this sequence makes it segfault with a null pointer error:

  • search for a town
  • select the town
  • search for a street
  • select the street
  • select View on map

Navit segfaults in graphics_process_selection_item at navit/graphics.c:2189:

graphics_process_selection_item(struct displaylist *dl, struct item *item)
{
        struct displayitem di,*di_res;
        GHashTable *h;
        int count,max=dl->dc.maxlen;
        struct coord ca[max];
        struct attr attr;
        struct map_rect *mr;

        di.item=*item;
        di.label=NULL;
        di.displayed=0;
        di.count=0;
        h=g_hash_table_lookup(dl->dl, GINT_TO_POINTER(di.item.type));
        if (h) {
                di_res=g_hash_table_lookup(h, &di);
                if (di_res) {
                        di.item.type=(enum item_type)item->priv_data;
                        display_add(dl, &di.item, di_res->count, di_res->c, NULL);
                        return;
                }
        }
        mr=map_rect_new(item->map, NULL);
        item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo);
->      count=item_coord_get(item, ca, item->type < type_line ? 1: max);
        if (!item_attr_get(item, attr_label, &attr))
                attr.u.str=NULL;
        if (dl->conv && attr.u.str && attr.u.str[0]) {
                char *str=map_convert_string(item->map, attr.u.str);
                display_add(dl, item, count, ca, str);
                map_convert_free(str);
        } else
                display_add(dl, item, count, ca, attr.u.str);
        map_rect_destroy(mr);
}

The item pointer returned by map_rect_get_item_byid is null.

Attachments (1)

fix-ticket-526 (582 bytes) - added by pini 10 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 10 years ago by pini

Hi,

I think I have a patch candidate (attached). As I'm not at ease with Navit's internals please double check it.

Thanks.

Changed 10 years ago by pini

comment:2 Changed 10 years ago by kazer

  • Resolution set to fixed
  • Status changed from new to closed

Applied in r2936. Thanks once more, pini!

Note: See TracTickets for help on using tickets.