From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Message-id: From: Pietro Gagliardi To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> In-reply-to: <515513BE-5416-43D9-8B63-DFABBEF24590@mac.com> Date: Wed, 4 Feb 2009 22:45:16 -0500 References: <5d375e920902041828p173f0f3etdd5fabd3a65bc330@mail.gmail.com> <515513BE-5416-43D9-8B63-DFABBEF24590@mac.com> Subject: Re: [9fans] sed crash Topicbox-Message-UUID: 96221988-ead4-11e9-9d60-3106f5b1d025 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The bug doesn't seem to be in sed. The match() function calls rregexec(), which sets a strucuture that is set to loc2, which is made null for some reason. On Feb 4, 2009, at 10:08 PM, Pietro Gagliardi wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > lp = loc2; > loc2 = sp - genbuf + linebuf; > while(*sp++ = *lp++) > > At the point of crash, loc2 is a null pointer when it is assigned to > lp, so when the while() statement executes, crash. Now to find out > why and when loc2 becomes null. > > On Feb 4, 2009, at 9:59 PM, Pietro Gagliardi wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> On Feb 4, 2009, at 9:28 PM, Uriel wrote: >> >>> For those that enjoy fixing bugs: >>> >>> % echo foo | sed >>> 's >>> /..a|..b|..c|..d|..e|..f|..g|..h|..i|..j|..k|..l|..m|..n|..o|..p//g' >>> >>> Will crash both native and p9p sed. >>> >>> Yes, I know it is a nonsensical expression, but it is the simplest >>> one >>> that still made it crash, I have lost the original version which was >>> much more complex. >>> >>> Note that providing two characters as input will still crash, but if >>> the input line is a single character it wont crash. >>> >>> I have been meaning to get all the fun of tracking this one down >>> myself for a while, but seems that I never get to it, so I will let >>> others enjoy the fun of fixing it. >>> >>> Peace >>> >>> uriel >>> >> For me, it crashes on the second line of input, in the dosub() >> function. Will investigate now. >> -----BEGIN PGP SIGNATURE----- >> Version: GnuPG v1.4.8 (Darwin) >> >> iEYEARECAAYFAkmKVgoACgkQuv7AVNQDs+x7ZACfYvtxSB5c8TD8LFFjPPHsgtah >> 9DwAnjIQ0GM4b82JGPpdJIUYfHjs7+Pv >> =7lRk >> -----END PGP SIGNATURE----- >> > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.8 (Darwin) > > iEYEARECAAYFAkmKWCEACgkQuv7AVNQDs+xSQQCgoFPwqMsaphtaKBTHHLFryiJr > eUMAnA9BjuDpMU40VqJp5hu1EDr3mdXp > =XF/E > -----END PGP SIGNATURE----- > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEUEARECAAYFAkmKYMwACgkQuv7AVNQDs+xcpACYi9wXYM/0ONUOOrqPJu4ViRFZ BACfTLv0GRuZzUP/WYeU72Jm+KqDunw= =Vrfb -----END PGP SIGNATURE-----