Bug 112644

Summary: MC crashes on import of large syntax files
Product: [Fedora] Fedora Reporter: Leonard den Ottolander <leonard-rh-bugzilla>
Component: mcAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: https://savannah.gnu.org/patch/?func=detailitem&item_id=1628
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-02-09 17:21:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
Fixes segfault that happens on import of large syntax file none

Description Leonard den Ottolander 2003-12-25 22:29:23 UTC
Description of problem:

 MC crashes on import of large syntax files.

Version-Release number of selected component (if applicable):

 mc-4.6.0-6 (also on RH9, mc-4.6.0-4)

How reproducible:

 Add about 10 lines to php.syntax. Now edit a php file and see
mc(edit) segfault.

Actual results:

 Segmentation fault

Expected results:

 Being able to use a big syntax file.

Additional info:

 A fix for this problem has been around since June 2003. I'll include
the patch anyway, since the one downloaded from
https://savannah.gnu.org/patch/?func=detailitem&item_id=1628 is

Comment 1 Leonard den Ottolander 2003-12-25 22:30:57 UTC
Created attachment 96699 [details]
Fixes segfault that happens on import of large syntax file

Comment 2 Leonard den Ottolander 2003-12-25 23:16:22 UTC
Duh. Thought the attached patch actually fixed the problem. The only
thing that happened however was that the php.syntax file was reverted
to it's old state when I upgraded the package ;-).

So the problem is still there.

Comment 3 Leonard den Ottolander 2003-12-26 01:28:55 UTC
What does work is increasing the size of MAX_WORDS_PER_CONTEXT to
something like 4096. This is enough for the php.syntax file I
submitted in bug #112645. Something like this should do:

--- mc-4.6.0/edit/syntax.c.000	2002-12-15 19:55:53.000000000 +0100
+++ mc-4.6.0/edit/syntax.c	2003-12-26 01:06:51.000000000 +0100
@@ -42,7 +42,7 @@
 #define UNKNOWN_FORMAT "unknown"
 #define MAX_CONTEXTS		128

 I added the above patch and a patch for the syntax file to a home
built rpm, and thus verified that it works.

Comment 4 Leonard den Ottolander 2004-01-21 09:48:27 UTC
Could the increase of MAX_WORDS_PER_CONTEXT to 4096 be applied to the
update that will probably be released one of these days?

(And maybe the syntax file as well?)

Comment 5 Jakub Jelinek 2004-01-30 20:35:37 UTC
The http://bugzilla.redhat.com/bugzilla/attachment.cgi?id=96699&action=view
patch is buggy and the latter is just a hack.
I chose to fix the former patch.  mc-4.6.0-8.3 is builting ATM and
will go to FC1 updates testing tonight.

Comment 6 Leonard den Ottolander 2004-01-30 21:36:01 UTC
That the patch is buggy I already mentioned in comment 2. But you are
going to try to fix that one?

Sure raising MAX_WORDS_PER_CONTEXT to 4096 is a hack, but since the
code was not setup to allocate memory dynamically it's just more
usable to increase it to that value.

But if you want to make this patch work that of course is much neater
solution. The large php syntax file might come in handy testing ;) .

By the way, could you please push 8.1 to the main update tree and get
out a security announcement? This has not happened yet for Fedora Core
so I presume many people are still running a vulnerable 6.

Comment 7 Leonard den Ottolander 2004-02-02 18:37:26 UTC
Last version of the patch (mc-4.6.0-8.4) seems to be working
correctly. Thanks.

I submitted this patch at
https://savannah.gnu.org/patch/?func=detailitem&item_id=1628 . Maybe
you could contact the upstream maintainer about this?

alloc_words_per_context += 1024;
in hunk #5 read
alloc_words_per_context += MAX_WORDS_PER_CONTEXT;

Comment 8 Leonard den Ottolander 2004-02-09 17:29:37 UTC
Fixed in mc-4.6.0-8.4. Closing ERRATA.