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

[PATCH perly.c] Invalid read of size 4

Thread Next
Marcus Holland-Moritz
August 28, 2003 01:01
[PATCH perly.c] Invalid read of size 4
Message ID:
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)

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 Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About