more.core

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

more.core

Steffen Wendzel-2
Hi.

I currently running an old 3.6 i386 box and I am not sure if this a)
realy is a bug and if this was already fixed... but here is the
problem:


$ ident /usr/bin/more
/usr/bin/more:
     $OpenBSD: crt0.c,v 1.12 2003/11/22 00:50:48 avsm Exp $
$ more log
0.9941860000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Segmentation fault (core dumped)
$ ll log
-rw-------  1 cdp_xe  cdp_xe  - 19.6M Jan  8 19:21 log

(the rest of the file contains zeros too).

PS. The program does not dump core if the file is smaller (i tested 13M)
    but dumps core too if the file is bigger.

PPS. I am unable to scroll my kde-terminal (konsole) after this coredump
     but xterm still works fine. Hope this hint will help you.

with regards
Steffen Wendzel

--
cdp.doomed-reality.org

Reply | Threaded
Open this post in threaded view
|

Re: more.core

Otto Moerbeek
On Sun, 8 Jan 2006, Steffen Wendzel wrote:

> Hi.
>
> I currently running an old 3.6 i386 box and I am not sure if this a)
> realy is a bug and if this was already fixed... but here is the
> problem:
>
>
> $ ident /usr/bin/more
> /usr/bin/more:
>      $OpenBSD: crt0.c,v 1.12 2003/11/22 00:50:48 avsm Exp $
> $ more log
> 0.9941860000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
> Segmentation fault (core dumped)
> $ ll log
> -rw-------  1 cdp_xe  cdp_xe  - 19.6M Jan  8 19:21 log
>
> (the rest of the file contains zeros too).
>
> PS. The program does not dump core if the file is smaller (i tested 13M)
>     but dumps core too if the file is bigger.
>
> PPS. I am unable to scroll my kde-terminal (konsole) after this coredump
>      but xterm still works fine. Hope this hint will help you.
>
> with regards
> Steffen Wendzel

Please show the output of gdb /usr/bin/more more.core
and then the command 'bt'

        -Otto

Reply | Threaded
Open this post in threaded view
|

Re: more.core

Otto Moerbeek
In reply to this post by Steffen Wendzel-2
On Sun, 8 Jan 2006, Steffen Wendzel wrote:

> Hi.
>
> I currently running an old 3.6 i386 box and I am not sure if this a)
> realy is a bug and if this was already fixed... but here is the
> problem:

[snip]
> Segmentation fault (core dumped)

Thanks for sending the core and the test file. Here's a diff that
should fix things.

        -Otto


Index: line.c
===================================================================
RCS file: /cvs/src/usr.bin/less/line.c,v
retrieving revision 1.8
diff -u -p -r1.8 line.c
--- line.c 27 Aug 2005 17:17:54 -0000 1.8
+++ line.c 10 Jan 2006 19:54:09 -0000
@@ -80,14 +80,18 @@ init_line()
 expand_linebuf()
 {
  int new_size = size_linebuf * 2;
- char *new_buf = (char *) realloc(linebuf, new_size);
- char *new_attr = (char *) realloc(attr, new_size);
- if (new_buf == NULL || new_attr == NULL)
- {
- if (new_attr != NULL)
- free(new_attr);
- if (new_buf != NULL)
- free(new_buf);
+ char *new_buf;
+ char *new_attr;
+
+ new_buf = realloc(linebuf, new_size);
+ if (new_buf == NULL)
+ return 1;
+ new_attr = realloc(attr, new_size);
+ if (new_attr == NULL) {
+ /* realloc linebuf back to original size */
+ linebuf = realloc(new_buf, size_linebuf);
+ if (linebuf == NULL)
+ err(1, NULL);
  return 1;
  }
  memset(new_buf + size_linebuf, 0, new_size - size_linebuf);

Reply | Threaded
Open this post in threaded view
|

Re: more.core

Steffen Wendzel-2
great ;) it now works fine!

 steffen




--
cdp.doomed-reality.org