Re: Where to report issues with mccolorer?

On Fri, 23 Jun 2006, Igor Russkih wrote:

(I'm seeing a crash when opening the syntax highlighting dialog for the
old syntax highlighting.)

Find attached a patch.

Thanks, Pavel!

There are some issues with edit_syntax_colorer_dialog() too:

1) The number of elements allocated for 'groups' is one less
than it should be. The extra element is needed for the NULL
terminator. Memory could be overwritten if the number of groups
is equal to the number of syntax types i.e. unique groups. This
is unlikely to happen but still...

2) This one is worse because it trashes memory every time :)
The memory allocated for 'types' in the while loop is used
to store the descriptions of the syntax types and the names
of the syntax types. Syntax type names are stored starting
at the end of the array and syntax names are stored at the
beginning. Now this line is wrong :

 types[types_list[0].items_number * 2 - types_num] = types_list[idx].name

The first time it is invoked it trashes the memory after the last
element of the 'types' array. I fixed it like this:

types = g_malloc(sizeof(char*) * ((types_list[0].items_number * 2) + 1));

i.e. allocat one more element. It makes sense to do so because you use
a NULL terminator for which no space is allocated again and this extra
bytes makes the wrong indexing above work as expected.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]