Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 428568 - app-misc/mc-4.8.4-r1: Segfaults when viewing HTML files
Summary: app-misc/mc-4.8.4-r1: Segfaults when viewing HTML files
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Alex Alexander (RETIRED)
URL: https://www.midnight-commander.org/ti...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2012-07-29 22:56 UTC by Nikos Chantziaras
Modified: 2012-07-30 13:00 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikos Chantziaras 2012-07-29 22:56:54 UTC
mc-4.8.4-r1 segfaults when viewing HTML files with "mc -v" or "mcview".  I've sent a report about it along with a patch to the upstream mailing list.  They don't seem to have an open bug tracker.  (There's https://bugs.launchpad.net/mc, but it doesn't allow me to report bugs.)  In case Gentoo wants to apply the quick fix to avoid the segfault, here's the message:

(I'm on Linux 64-bit.  This happens with current Git master as well as the 4.8.4 release.  4.8.3 does not have the issue.  I could not bisect the commit causing this because somewhere along the way, viewing HTML files is not possible at all.)

When viewing HTML files with "mc -v" (or "mcview"), a segfault occurs. Call stack:

  name_quote (lib/util.c:256)
  expand_format (src/filemanager/usermenu.c:863)
  regex_command (src/filemanager/ext.c:177)
  view_file_at_line (src/filemanager/cmd.c:647)
  do_nc (src/filemanager/midnight.c:1006)
  main (src/main.c:567)

In name_quote(), 's' is NULL and thus a segfault occurs when dereferencing it.  Quick fix below.  The proper fix is probably to avoid the whole thing in expand_format().


diff --git a/lib/util.c b/lib/util.c
index a56e2c8..52610a4 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -253,6 +253,11 @@ name_quote (const char *s, int quote_percent)
 {
     char *ret, *d;

+    if (s == NULL)
+    {
+        return NULL;
+    }
+
     d = ret = g_malloc (strlen (s) * 2 + 2 + 1);
     if (*s == '-')
     {
Comment 1 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2012-07-30 01:06:33 UTC
You can report bugs upstream at https://www.midnight-commander.org (you have to register/login to the website first).
Comment 2 Rafał Mużyło 2012-07-30 01:07:37 UTC
What gave you the idea mc is a launchpad project ?

The proper address is www.midnight-commander.org and the tracker is right there.
Comment 3 Nikos Chantziaras 2012-07-30 01:14:44 UTC
Because I was looking at this:

http://www.gnu.org/software/mc

It doesn't list a bug tracker.  Google gives:

https://bugs.launchpad.net/bugs/bugtrackers/mc-bugs

And right there, at the top, it says: "New official bug tracker for Midnight Commander project"
Comment 4 Nikos Chantziaras 2012-07-30 08:13:41 UTC
Proper upstream bug:

https://www.midnight-commander.org/ticket/2858

with a proper patch.
Comment 5 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2012-07-30 13:00:51 UTC
+*mc-4.8.4-r2 (30 Jul 2012)
+
+  30 Jul 2012; Lars Wendler <polynomial-c@gentoo.org> -mc-4.8.4-r1.ebuild,
+  +mc-4.8.4-r2.ebuild,
+  +files/mc-4.8.4-Ticket-2853-fileposition-in-mcedit.patch,
+  +files/mc-4.8.4-Ticket-2858-htmlview-segfault.patch:
+  non-maintainer commit: Fixed fileposition no longer remembered by mcedit (bug
+  #427786). Fixed segfault when viewing html files (bug #428568).
+