Date: Fri, 17 Oct 2008 23:04:45 +0900 (JST) From: Hiroki Sato <hrs@FreeBSD.org> To: delphij@FreeBSD.org Cc: freebsd-bugs@FreeBSD.org Subject: Re: bin /126682: sed(1) segfaults on error rather than error message Message-ID: <20081017.230445.40852815.hrs@allbsd.org> In-Reply-To: <200808201608.m7KG8X6n063029@freefall.freebsd.org> References: <200808201608.m7KG8X6n063029@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
----Security_Multipart0(Fri_Oct_17_23_04_45_2008_136)-- Content-Type: Multipart/Mixed; boundary="--Next_Part(Fri_Oct_17_23_04_45_2008_655)--" Content-Transfer-Encoding: 7bit ----Next_Part(Fri_Oct_17_23_04_45_2008_655)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi Xin, The attached patch should be a workaround. Can you review this? -- | Hiroki SATO ----Next_Part(Fri_Oct_17_23_04_45_2008_655)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sed-compile.c.diff" Index: compile.c =================================================================== RCS file: /home/ncvs/src/usr.bin/sed/compile.c,v retrieving revision 1.30 diff -d -u -I\$FreeBSD:.*\$ -I\$NetBSD:.*\$ -I\$OpenBSD:.*\$ -I\$DragonFly:.*\$ -I\$Id:.*\$ -I\$Translation:.*\$ -I\$hrs:.*\$ -r1.30 compile.c --- compile.c 6 Jul 2007 16:34:56 -0000 1.30 +++ compile.c 19 Jul 2008 15:28:00 -0000 @@ -324,9 +324,17 @@ if (p == NULL) errx(1, "%lu: %s: unterminated substitute pattern", linenum, fname); + + /* Compile RE with no case sensitivity temporarily */ + if (*re == '\0') + cmd->u.s->re = NULL; + else + cmd->u.s->re = compile_re(re, 0); --p; p = compile_subst(p, cmd->u.s); p = compile_flags(p, cmd->u.s); + + /* Recompile RE with case sensitivity from "I" flag if any */ if (*re == '\0') cmd->u.s->re = NULL; else ----Next_Part(Fri_Oct_17_23_04_45_2008_655)---- ----Security_Multipart0(Fri_Oct_17_23_04_45_2008_136)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkj4m30ACgkQTyzT2CeTzy05cwCfaIFhz1NxK0chNQc6WlXF91EP kxwAoNG0Gm0lgV4NbA1BHFHGSF2ZmgGY =9C26 -----END PGP SIGNATURE----- ----Security_Multipart0(Fri_Oct_17_23_04_45_2008_136)----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081017.230445.40852815.hrs>