develooper Front page | perl.perl5.porters | Postings from August 2003

[PATCH perly.c] Invalid read of size 4

Thread Next
From:
Marcus Holland-Moritz
Date:
August 28, 2003 01:01
Subject:
[PATCH perly.c] Invalid read of size 4
Message ID:
003a01c36d3a$804dd0e0$ae4eeed9@R2D2
Forgive me for patching perly.c, but I simply don't know how
to patch/regenerate perly_c.diff correctly. I found something
about it in Porting/pumpkin.pod, so maybe... :)

However, the attached patch fixes the following memory
access error:

  "Invalid read of size 4"
      Perl_yyparse (perly.c:1599)
          t/comp/parser.t

This happens before the big switch() in perly.c. The parser
initializes yyval with yyvsp[1-yym], which lies outside of
the allocated stack buffer and causes the valgrind error.
If you look after the switch(), you can see that the stack
buffer is properly reallocated before storing the value back.
So there's no "invalid write".

The patch leaves yyval uninitialized in case the stack buffer
is too small. But that should be no worse than initializing
with unknown data.

-- Marcus

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About