[PATCH] Re: Segfault on loading of non existent syntax file
Leonard den Ottolander
leonard at den.ottolander.nl
Sun Mar 26 21:42:41 UTC 2006
Hi,
On Thu, 2006-02-02 at 20:33 +0100, Leonard den Ottolander wrote:
> Ran mc from a temporary build dir and copied Syntax to ~/.mc/cedit/ .
> Tried editing a file and saw a segfault when the non existent syntax
> file is attempted to be loaded.
>
> #0 edit_get_rule (edit=0x92e8dc0, byte_index=-1) at syntax.c:285
> #1 0x080a4161 in edit_free_syntax_rules (edit=0x92e8dc0) at
> syntax.c:977
A fix is attached. When edit_load_syntax() fails on Syntax because the
target syntax file is missing there are no syntax rules to be freed,
just an uninitialized rules block. That block needs to be (freed and)
set to NULL or the editor will attempt to load the block as if it were
valid rules and still crash.
Leonard.
--
mount -t life -o ro /dev/dna /genetic/research
-------------- next part --------------
A non-text attachment was scrubbed...
Name: syntax.c.nonexistent.patch
Type: text/x-patch
Size: 1393 bytes
Desc: not available
URL: <http://lists.midnight-commander.org/pipermail/mc-devel/attachments/20060326/5142eb23/attachment.bin>
More information about the mc-devel
mailing list