nayakgi / perl-compiler

Automatically exported from code.google.com/p/perl-compiler
Other
0 stars 0 forks source link

B::C does not check for an undefined $fullname in B::PVMG::save input arg even though it's called as such in some cases #321

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Run perlcc on core test:
$ perl script/perlcc t/CORE/op/magic-27839.t
script/perlcc: Unexpected compiler output
Dying on warning: Use of uninitialized value $fullname in pattern match (m//) 
at /usr/local/lib/perl5/site_perl/5.14.4/i386-linux-64int/B/C.pm line 2533.
 CHECK failed--call queue aborted.
/usr/lib/gcc/i686-redhat-linux/4.4.7/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status

The compilation process fails due to unexpected output.

Here is a patch to just check for an undefined $fullname value before running 
the regular expression:

diff --git a/lib/B/C.pm b/lib/B/C.pm
index bf70647..3a444da 100644
--- a/lib/B/C.pm
+++ b/lib/B/C.pm
@@ -2529,7 +2529,7 @@ sub B::PVMG::save {
     # Detect ptr to extern symbol in shared library and remap it in init2
     # Safe and mandatory currently only Net-DNS-0.67 - 0.74.
     # svop const or pad OBJECT,IOK
-    if ($fullname =~ /^svop const|^padop|^Encode::Encoding| :pad\[1\]/ 
+    if ($fullname && $fullname =~ /^svop const|^padop|^Encode::Encoding| 
:pad\[1\]/
         and $ivx =~ /U?L+$/
         and ref($sv->SvSTASH) ne 'B::SPECIAL')
     {

Original issue reported on code.google.com by chro...@gmail.com on 7 May 2014 at 11:46

GoogleCodeExporter commented 9 years ago
Thanks, cannot repro but fixed with commit 
026c297612ded37eefd45b13f49721063bdbce34
Author: Reini Urban <rurban@cpanel.net>
Date:   Thu May 8 08:26:42 2014 -0500

    C: protect from empty $fullname arg to B::PVMG::save

    detected and fixed by Todd Rinaldo, fixes #321

Original comment by reini.urban on 8 May 2014 at 1:27

GoogleCodeExporter commented 9 years ago
Oops, of course it came from Chris, not Todd. sorry

Original comment by reini.urban on 8 May 2014 at 3:04