dc(1) -e "6 2 / p" is still broken as of r207919

Alexey Shuvaev shuvaev at physik.uni-wuerzburg.de
Wed May 12 16:55:36 UTC 2010


Hello!

Just to remind that still:

~> dc -e "6 2 / p"
Segmentation fault (core dumped)

This was already mentioned on this list:
http://lists.freebsd.org/pipermail/freebsd-current/2010-April/016560.html
and there is a patch proposed in the same thread:
http://lists.freebsd.org/pipermail/freebsd-current/2010-April/016603.html

Note, however, that reverting r203438 also fixes the problem (gabor@ CC-ed),
so I'm not sure what is the right way to fix it.
Attached is slightly modified reverse patch to revert 203438.

Thanks,
Alexey.
-------------- next part --------------
--- dc.c	2010/01/20 21:30:52	202719
+++ dc.c	2010/02/03 19:13:41	203438
@@ -82,15 +82,7 @@
 {
 	int ch;
 	bool extended_regs = false, preproc_done = false;
-	char		*buf;
 
-	if ((buf = strdup("")) == NULL)
-		err(1, NULL);
-
-	init_bmachine(extended_regs);
-	setlinebuf(stdout);
-	setlinebuf(stderr);
-
 	/* accept and ignore a single dash to be 4.4BSD dc(1) compatible */
 	while ((ch = getopt_long(argc, argv, "e:f:Vx", long_options, NULL)) != -1) {
 		switch (ch) {
@@ -123,6 +115,10 @@
 	argc -= optind;
 	argv += optind;
 
+	init_bmachine(extended_regs);
+	setlinebuf(stdout);
+	setlinebuf(stderr);
+
 	if (argc > 1)
 		usage();
 	if (argc == 1) {


More information about the freebsd-current mailing list