Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoloaded &VERSION and UNIVERSAL::VERSION don't mix #454

Closed
p5pRT opened this issue Aug 29, 1999 · 1 comment
Closed

Autoloaded &VERSION and UNIVERSAL::VERSION don't mix #454

p5pRT opened this issue Aug 29, 1999 · 1 comment

Comments

@p5pRT
Copy link

p5pRT commented Aug 29, 1999

Migrated from rt.perl.org#1295 (status was 'resolved')

Searchable as RT1295$

@p5pRT
Copy link
Author

p5pRT commented Aug 29, 1999

From spider@Orb.Nashua.NH.US

Depending on memory allocation patterns, the use of UNIVERSAL​::VERSION
can cause a segfault if the target package has a stub declaration for
its &VERSION. This is because it's not checking that the value it
gets back from its hv_fetch is really a GV, and in the case of stub
declarations it's an IV or a PV.

This fixes that, and causes it to understand an undef GvSV as well as
an undef gv as being "(undef)".

Inline Patch
--- universal.c.DIST	Tue Jul 20 13:18:16 1999
+++ universal.c	Sun Aug 29 18:58:08 1999
@@ -197,7 +197,7 @@ XS(XS_UNIVERSAL_VERSION)
 
     gvp = pkg ? (GV**)hv_fetch(pkg,"VERSION",7,FALSE) : Null(GV**);
 
-    if (gvp && (gv = *gvp) != (GV*)&PL_sv_undef && (sv = GvSV(gv))) {
+    if (gvp && isGV(gv = *gvp) && SvOK(sv = GvSV(gv))) {
         SV *nsv = sv_newmortal();
         sv_setsv(nsv, sv);
         sv = nsv;
Perl Info


Site configuration information for perl 5.00561:

Configured by spider at Fri Aug 27 06:56:26 EDT 1999.

Summary of my perl5 (revision 5.0 version 5 subversion 61) configuration:
  Platform:
    osname=dec_osf, osvers=4.0, archname=alpha-dec_osf
    uname='osf1 orb.nashua.nh.us x4.0 834 alpha '
    config_args='-dsEO -Darchlib=/local/opt/perl/lib/5.00561/alpha-dec_osf -Dbin=/local/bin/exp -Dbinexp=/local/bin/exp -Dcc=cc -Dccflags=-std -I/usr/local/include -DDEBUGGING -DDEBUGGING_OPS -D_INTRINSICS -D_INLINE_INTRINSICS -Drand=__random -Dsrand=__srandom -DUSE_PERL_SBRK -DPERL_SBRK_VIA_MALLOC -DEMBEDMYMALLOC= -fprm d -ieee -Ud_bincompat3 -Ud_bincompat5005 -Dd_dosuid=define -Dinstallbin=/local/OSF1/alpha/bin/exp -Uinstallstyle= -Dlddlflags=-shared -msym -expect_unresolved "*" -g -std -Dldflags=-std -msym -g -Dlibswanted=sfio gdbm m -Dman1dir=/local/man/man1 -Dman1ext=1 -Dman3dir=/local/man/man3 -Dman3ext=3pl -Doptimize=-g -Dpager=/local/bin/less -Dprefix=/local/opt/perl -Dscriptdir=/local/share/exp -Dsitelib=/local/opt/perl/lib/site_perl/5.00561 -Dsitearch=/local/opt/perl/lib/site_perl/5.00561/alpha-dec_osf -Duseshrplib -Ud_safemcpy= -Ud_sfio= -Ui_dbm -Uinstallarchlib= -Uinstallprivlib= -Uinstallscript= -Uinstallsitearch= -Uinstallsitelib= -Uinstallusrbinperl -Ulibs= -Upe!
!
!
rlpath= -Uprivlib= -Urandbits= -Uusethreads -Dusemymalloc=y -e'
    hint=previous, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
    use64bits=undef usemultiplicity=undef
  Compiler:
    cc='cc', optimize='-g', gccversion=
    cppflags='-std -I/usr/local/include -DDEBUGGING -DDEBUGGING_OPS -D_INTRINSICS -D_INLINE_INTRINSICS -Drand=__random -Dsrand=__srandom -DUSE_PERL_SBRK -DPERL_SBRK_VIA_MALLOC -DEMBEDMYMALLOC= -ieee'
    ccflags ='-std -I/usr/local/include -DDEBUGGING -DDEBUGGING_OPS -D_INTRINSICS -D_INLINE_INTRINSICS -Drand=__random -Dsrand=__srandom -DUSE_PERL_SBRK -DPERL_SBRK_VIA_MALLOC -DEMBEDMYMALLOC= -fprm d -ieee'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=8, ptrsize=8, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags ='-std -msym -g -L/usr/local/lib'
    libpth=/usr/local/lib /usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /var/shlib
    libs=-lgdbm -lm
    libc=/usr/shlib/libc.so, so=so, useshrplib=true, libperl=libperl.so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='  -Wl,-rpath,/local/opt/perl/lib/5.00561/alpha-dec_osf/CORE'
    cccdlflags=' ', lddlflags='-shared -msym -expect_unresolved "*" -g -std -L/usr/local/lib'

Locally applied patches:
    


@INC for perl 5.00561:
    /local/opt/perl/lib/5.00561/alpha-dec_osf
    /local/opt/perl/lib/5.00561
    /local/opt/perl/lib/site_perl/5.00561/alpha-dec_osf
    /local/opt/perl/lib/site_perl
    .


Environment for perl 5.00561:
    HOME=/users/spider
    LANG=en_US.ISO8859-1
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/users/spider/bin/OSF1/alpha:/users/spider/bin:/local/OSF1/alpha/bin:/local/share:/local/OSF1/alpha/sbin:/local/etc:/usr/local:/tcb/bin:/usr/ccs/bin:/usr/bin:/usr/lbin:/usr/dt/bin:/usr/bin/X11:/usr/bin/mme:/usr/sbin:/sbin:/usr/field:/usr/opt/SWN200/bin:/local/OSF1/alpha/bin/mnt:/local/share/mnt:.
    PERL_BADLANG (unset)
    SHELL=/usr/bin/ksh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant