Opened 9 years ago

Closed 7 years ago

#871 closed defect/bug (fixed)

[valgrind] Invalid read in transform.c

Reported by: pini Owned by: KaZeR
Priority: major Milestone: version 0.5.1
Component: core Version: git master
Severity: Keywords: valgrind, transform
Cc: http://wiki.navit-project.org/index.php/user:pini

Description

Hi,

Here is another valgrind error, which was triggered with the sequence: Click on map / Action / Point on map:

==7220== Invalid read of size 4
==7220==    at 0x80924BE: transform_within_dist_line (transform.c:1365)
==7220==    by 0x8092770: transform_within_dist_polyline (transform.c:1414)
==7220==    by 0x80928D8: transform_within_dist_polygon (transform.c:1430)
==7220==    by 0x8092975: transform_within_dist_item (transform.c:1444)
==7220==    by 0x5819E8B: gui_internal_cmd_position_do (gui_internal.c:2831)
==7220==    by 0x581A5BA: gui_internal_cmd2_position (gui_internal.c:2958)
==7220==    by 0x80963F1: command_table_call (command.c:903)
==7220==    by 0x805FA42: callback_call (callback.c:163)
==7220==    by 0x805FC99: callback_list_call_attr (callback.c:219)
==7220==    by 0x805FD5C: callback_list_call_attr_args (callback.c:235)
==7220==    by 0x8094BBE: command_call_function (command.c:402)
==7220==    by 0x8094DEC: eval_postfix (command.c:444)
==7220==    by 0x8094EE5: eval_unary (command.c:462)
==7220==    by 0x8094F13: eval_multiplicative (command.c:471)
==7220==    by 0x809518C: eval_additive (command.c:504)
==7220==    by 0x809537E: eval_equality (command.c:531)
==7220==    by 0x8095652: eval_bitwise_and (command.c:572)
==7220==    by 0x8095759: eval_bitwise_xor (command.c:589)
==7220==    by 0x8095830: eval_bitwise_or (command.c:605)
==7220==    by 0x8095936: eval_logical_and (command.c:622)
==7220==  Address 0x66735b4 is 0 bytes after a block of size 36 alloc'd
==7220==    at 0x4024046: realloc (vg_replace_malloc.c:525)
==7220==    by 0x40AC319: g_realloc (in /lib/libglib-2.0.so.0.2800.6)
==7220==    by 0x80888C7: street_get_data (route.c:2618)
==7220==    by 0x5819E56: gui_internal_cmd_position_do (gui_internal.c:2830)
==7220==    by 0x581A5BA: gui_internal_cmd2_position (gui_internal.c:2958)
==7220==    by 0x80963F1: command_table_call (command.c:903)
==7220==    by 0x805FA42: callback_call (callback.c:163)
==7220==    by 0x805FC99: callback_list_call_attr (callback.c:219)
==7220==    by 0x805FD5C: callback_list_call_attr_args (callback.c:235)
==7220==    by 0x8094BBE: command_call_function (command.c:402)
==7220==    by 0x8094DEC: eval_postfix (command.c:444)
==7220==    by 0x8094EE5: eval_unary (command.c:462)
==7220==    by 0x8094F13: eval_multiplicative (command.c:471)
==7220==    by 0x809518C: eval_additive (command.c:504)
==7220==    by 0x809537E: eval_equality (command.c:531)
==7220==    by 0x8095652: eval_bitwise_and (command.c:572)
==7220==    by 0x8095759: eval_bitwise_xor (command.c:589)
==7220==    by 0x8095830: eval_bitwise_or (command.c:605)
==7220==    by 0x8095936: eval_logical_and (command.c:622)
==7220==    by 0x8095A1B: eval_logical_or (command.c:638)

It appears that transform.c:transform_within_dist_item() doesn't know how to deal with item_type map_information which has zero points (count == 0).

The attached patch needs some review. It's just a workaround since I don't know how this case should be handled by transform_within_dist_item().

Thanks.

Attachments (1)

valgrind-transform.patch (779 bytes) - added by pini 9 years ago.

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by pini

comment:1 Changed 9 years ago by pini

  • Cc http://wiki.navit-project.org/index.php/user:pini added

comment:2 Changed 7 years ago by usul

  • Keywords valgrind transform added
  • Milestone set to version 0.5.1

Was this patch applied yet? Does this error still occure?

comment:3 Changed 7 years ago by gilles filippini

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

The patch hasn't been applied. But this "invalid read" error doesn't occur anymore with SVN r5549.

Note: See TracTickets for help on using tickets.