[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Seg fault with HTML::Parser



Chip Salzenberg <chip@debian.org> writes:

> According to Gisle Aas:
> > (xxx.pl:4)      repeat
> >     =>  ... IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  IV(1)  
> > (xxx.pl:4)      push
> >     =>  \HV()  PV("</TD>"\0)  IV(505)  
> > (xxx.pl:4)      nextstate
> >     =>  \HV()  PV("</TD>"\0)  
> > (xxx.pl:4)      const(IV(1))
> >     =>  \HV()  PV("</TD>"\0)  IV(1)  
> > (xxx.pl:4)      leavesub
> >     =>  ... VOID  
> > 
> > No more output this time.
> 
> Is that good or bad?  There's no underflow, anyway.

What is happening is that pp_repeat will relocate the stack in this
case.  I think the problem is that something else keeps a stale stack
pointer around.  A missing SPAGAIN somewhere.  The C stack looks like
this when we enter pp_repeat:

Breakpoint 1, Perl_pp_repeat () at pp.c:1392
1392      dSP; dATARGET; tryAMAGICbin(repeat,opASSIGN);
(gdb) bt
#0  Perl_pp_repeat () at pp.c:1392
#1  0x080b4f69 in Perl_runops_debug () at dump.c:1443
#2  0x080640b0 in S_call_body (myop=0xbffff580, is_eval=0) at perl.c:2096
#3  0x08063d13 in Perl_call_sv (sv=0x81dec3c, flags=134) at perl.c:2014
#4  0x401ff72e in report_event (p_state=0x8183b48, event=E_END, beg=0x8191320 "</TD>", end=0x8191325 "",
    tokens=0xbffff670, num_tokens=1, self=0x818a75c) at hparser.c:547
#5  0x4020179f in parse_end (p_state=0x8183b48, beg=0x8191320 "</TD>", end=0x8191325 "", self=0x818a75c)
    at hparser.c:1330
#6  0x40201e41 in parse_buf (p_state=0x8183b48, beg=0x8191320 "</TD>", end=0x8191325 "", self=0x818a75c)
    at hparser.c:1551
#7  0x402022c2 in parse (p_state=0x8183b48, chunk=0x81debc4, self=0x818a75c) at hparser.c:1658
#8  0x40202f15 in XS_HTML__Parser_parse (cv=0x81cbbb8) at Parser.xs:265
#9  0x080d5f0b in Perl_pp_entersub () at pp_hot.c:2763
#10 0x080b4f69 in Perl_runops_debug () at dump.c:1443
#11 0x080633cc in S_run_body (oldscope=1) at perl.c:1732
#12 0x08062f34 in perl_run (my_perl=0x817bd88) at perl.c:1651
#13 0x0805e79d in main (argc=2, argv=0xbffff9b4, env=0xbffff9c0) at perlmain.c:86
#14 0x400b7336 in __libc_start_main (main=0x805e700 <main>, argc=2, ubp_av=0xbffff9b4, init=0x805d7c4 <_init>,
    fini=0x81543a0 <_fini>, rtld_fini=0x4000d2fc <_dl_fini>, stack_end=0xbffff9ac) at ../sysdeps/generic/libc-start.c:129

--Gisle



Reply to: