Subject: pkg/17358: www/links-gui 2.0 suffers several serious flaws and limitations
To: None <gnats-bugs@gnats.netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 06/22/2002 02:21:00
>Number:         17358
>Category:       pkg
>Synopsis:       www/links-gui 2.0 suffers several serious flaws and limitations
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 21 23:22:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Greg A. Woods
>Release:        pkgsrc-2002/06/22
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
System: NetBSD 1.5W
Architecture: i386
Machine: i386
>Description:

	www/links-gui 2.0 seems to suffer several serious flaws and
	limitations that makes it unusable in some environments.

	the first flaw is a fatal bug apparently caused by broken
	command-line parameter handling.  Upgrade to 2.1pre1 to fix.

	the second problem is a serious limitation in the X11 driver
	support -- links fails to work on 1-bit and 8-bit displays.

>How-To-Repeat:

$ ./links -g 
INTERNAL ERROR at x.c:1001: mem_free(NULL)

Forcing core dump
Memory fault 
ksh: exit code: 139

$ ./links -g -driver x
INTERNAL ERROR at x.c:1001: mem_free(NULL)

Forcing core dump
Memory fault 
ksh: exit code: 139


$ gdb ./links ./links.core                                                              
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386--netbsd"...
Core was generated by `links'.
Program terminated with signal 11, Segmentation fault.
#0  0x820394f in kill ()
(gdb) where
#0  0x820394f in kill ()
#1  0x81d3271 in raise ()
#2  0x8072688 in int_error (m=0x82125cd "mem_free(NULL)") at error.c:47
#3  0x807283f in debug_mem_free (file=0x8254a88 "x.c", line=1001, p=0x0)
    at error.c:202
#4  0x80ed698 in x_init_driver (param=0x0, 
    display=0xbfbfd8f8 "xtremely.weird.com:0.0") at x.c:1001
#5  0x8071e18 in init_graphics_driver (gd=0x841b140, param=0x82a39a0 "", 
    display=0x82a3da0 "") at drivers.c:83
#6  0x8071e92 in init_graphics (driver=0x82a35a0 "x", param=0x82a39a0 "", 
    display=0x82a3da0 "") at drivers.c:94
#7  0x80bb1be in init () at main.c:311
#8  0x80c92fd in select_loop (init=0x80baff4 <init>) at select.c:366
#9  0x80bb4de in main (argc=4, argv=0xbfbfcefc) at main.c:406
#10 0x80481e5 in ___start ()
(gdb) up
#1  0x81d3271 in raise ()
(gdb) up
#2  0x8072688 in int_error (m=0x82125cd "mem_free(NULL)") at error.c:47
47              raise(SIGSEGV);
(gdb) up
#3  0x807283f in debug_mem_free (file=0x8254a88 "x.c", line=1001, p=0x0)
    at error.c:202
202                     errfile = file, errline = line, int_error("mem_free(NULL)");
(gdb) list
197     #ifdef LEAK_DEBUG
198             struct alloc_header *ah;
199     #endif
200             if (p == DUMMY) return;
201             if (!p) {
202                     errfile = file, errline = line, int_error("mem_free(NULL)");
203                     return;
204             }
205     #ifdef LEAK_DEBUG
206             p = (char *)p - L_D_S;
(gdb) up
#4  0x80ed698 in x_init_driver (param=0x0, 
    display=0xbfbfd8f8 "xtremely.weird.com:0.0") at x.c:1001
1001                    mem_free(x_driver_param);
(gdb) list
996                                             }
997                                     }
998                             }
999                             
1000                    x_free_hash_table();
1001                    mem_free(x_driver_param);
1002                    return stracpy("No supported color depth found.\n");
1003    visual_found:;
1004            }
1005    
(gdb) print x_driver_param
$1 = (unsigned char *) 0x0
(gdb) quit


	The second issue:

$ ./links -g -driver x -mode 400x800
Could not initialize graphics driver x:
No supported color depth found.
ksh: exit code: 3


>Fix:

	the first problem is apparently fixed in the latest release:

		=== RELEASE 2.1pre1
		
		Tue Jun 11 14:23:52 MET DST 2002 brain:
		
		        Fixed mem_free(NULL) in x.c:1001


	the status of fixes for the second issue is unknown....

>Release-Note:
>Audit-Trail:
>Unformatted: