Bug 112644 - MC crashes on import of large syntax files
MC crashes on import of large syntax files
Product: Fedora
Classification: Fedora
Component: mc (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2003-12-25 17:29 EST by Leonard den Ottolander
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-02-09 12:21:51 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Fixes segfault that happens on import of large syntax file (3.48 KB, patch)
2003-12-25 17:30 EST, Leonard den Ottolander
no flags Details | Diff

  None (edit)
Description Leonard den Ottolander 2003-12-25 17:29:23 EST
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 17:30:57 EST
Created attachment 96699 [details]
Fixes segfault that happens on import of large syntax file
Comment 2 Leonard den Ottolander 2003-12-25 18:16:22 EST
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-25 20:28:55 EST
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 04:48:27 EST
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 15:35:37 EST
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 16:36:01 EST
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 13:37:26 EST
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 12:29:37 EST
Fixed in mc-4.6.0-8.4. Closing ERRATA.

Note You need to log in before you can comment on or make changes to this bug.