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

Blessed reference to anonymous glob causes seg fault or "Attempt to free unrefer #7144

Closed
p5pRT opened this issue Mar 1, 2004 · 4 comments
Closed

Comments

@p5pRT
Copy link

p5pRT commented Mar 1, 2004

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

Searchable as RT27268$

@p5pRT
Copy link
Author

p5pRT commented Mar 1, 2004

From demerphq@hotmail.com

This is a bug report for perl from demerphq@​hotmail.com,
generated with the help of perlbug 1.33 running under perl v5.6.1.


On 5.8.2 (AS 808)​:

D​:\Temp>perl -MSymbol -e "my $x=bless \gensym,'t'; *$$x=$x"
Attempt to free unreferenced scalar​: SV 0x15d4f38 during global destruction.

on 5.6.1 (AS 635)​:
D​:\Temp>perl -MSymbol -e "my $x=bless \gensym,'t'; *$$x=$x"
(SEGFAULTS)

This also applies to non Win32 builds. All versions of perl this was checked
against threw errors regardless of perl version or OS.

Regards,
Yves



Flags​:
  category=core
  severity=low


Site configuration information for perl v5.6.1​:

Configured by ActiveState at Mon Jun 17 21​:32​:50 2002.

Summary of my perl5 (revision 5 version 6 subversion 1) configuration​:
  Platform​:
  osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
  uname=''
  config_args='undef'
  hint=recommended, useposix=true, d_sigaction=undef
  usethreads=undef use5005threads=undef useithreads=define
usemultiplicity=define
  useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
  use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler​:
  cc='cl', ccflags ='-nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE
-DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-DPERL_MSVCRT_READFIX',
  optimize='-O1 -MD -DNDEBUG',
  cppflags='-DWIN32'
  ccversion='', gccversion='', gccosandvers=''
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
  d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
  ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
  alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries​:
  ld='link', ldflags ='-nologo -nodefaultlib -release
-libpath​:"E​:\Perl\lib\CORE" -machine​:x86'
  libpth="E​:\DotNet\FrameworkSDK\Lib\" "E​:\Perl\lib\CORE"
  libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
msvcrt.lib
  perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib
msvcrt.lib
  libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
  Dynamic Linking​:
  dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release
-libpath​:"E​:\Perl\lib\CORE" -machine​:x86'

Locally applied patches​:
  ACTIVEPERL_LOCAL_PATCHES_ENTRY


@​INC for perl v5.6.1​:
  D​:\development\perl\devlib
  E​:/Perl/lib
  E​:/Perl/site/lib
  .


Environment for perl v5.6.1​:
  HOME (unset)
  LANG (unset)
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
 
PATH=E​:\Editors\UltraEdit;E​:\DotNet\Common7\IDE;E​:\DotNet\VC7\BIN;E​:\DotNet\Common7\Tools;E​:\DotNet\Common7\Tools\bin\prerelease;E​:\DotNet\Common7\Tools\bin;E​:\DotNet\FrameworkSDK\bin;C​:\WINNT\Microsoft.NET\Framework\v1.0.3705;e​:\sybase\OCS-12_0\dll;e​:\sybase\OCS-12_0\bin;C​:\WINNT\system32;C​:\Program
Files\Symantec\pcAnywhere\;C​:\WINNT;C​:\WINNT\System32\Wbem;E​:\Editors\ULTRAE~1;E​:\Perforce;E​:\Perl\bin\;E​:\bin;E​:\cygwin\bin;E​:\perl58\bin;E​:\sybase;E​:\sybase\sqladvantage;e​:\sybase\ASEP;e​:\sybase\SQLRemote\dll;perl\bleadperl\bin
  PERL5LIB=D​:\development\perl\devlib
  PERL5_CPANPLUS_CONFIG=e​:\.cpanplus\config
  PERL_BADLANG (unset)
  SHELL (unset)

_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http​://join.msn.com/?page=features/virus

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2004

From @iabyn

On Mon, Mar 01, 2004 at 03​:19​:09PM -0000, Yves Orton wrote​:

On 5.8.2 (AS 808)​:

D​:\Temp>perl -MSymbol -e "my $x=bless \gensym,'t'; *$$x=$x"
Attempt to free unreferenced scalar​: SV 0x15d4f38 during global destruction.

on 5.6.1 (AS 635)​:
D​:\Temp>perl -MSymbol -e "my $x=bless \gensym,'t'; *$$x=$x"
(SEGFAULTS)

The following change fixes the warning; I'm assuming the coredump has
already been fixed.

Dave.

Change 22591 by davem@​davem-percy on 2004/03/26 01​:16​:55

  [perl #27268] Blessed reference to anonymous glob
  Stop *$$x=$x giving "Attempt to free unreferenced scalar" warning

Affected files ...

... //depot/perl/sv.c#731 edit
... //depot/perl/t/op/ref.t#21 edit

Differences ...

==== //depot/perl/sv.c#731 (text) ====

@​@​ -410,6 +410,7 @​@​
  (GvCV(sv) && SvOBJECT(GvCV(sv))) )
  {
  DEBUG_D((PerlIO_printf(Perl_debug_log, "Cleaning named glob object​:\n "), sv_dump(sv)));
+ SvFLAGS(sv) |= SVf_BREAK;
  SvREFCNT_dec(sv);
  }
  }

==== //depot/perl/t/op/ref.t#21 (xtext) ====

@​@​ -5,7 +5,7 @​@​
  @​INC = qw(. ../lib);
}

-print "1..68\n";
+print "1..69\n";

require 'test.pl';

@​@​ -357,6 +357,16 @​@​
if ($? != 0) { print "not " };
print "ok ",++$test," - coredump on typeglob = (SvRV && !SvROK)\n";

+# bug #27268​: freeing self-referential typeglobs could trigger
+# "Attempt to free unreferenced scalar" warnings
+
+$result = runperl(
+ prog => 'use Symbol;my $x=bless \gensym,"t"; print;*$$x=$x',
+ stderr => 1
+);
+print "not " if length $result;
+print "ok ",++$test," - freeing self-referential typeglob\n";
+print "# got​: $result\n" if length $result;

# test global destruction

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2004

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2004

@iabyn - Status changed from 'open' to 'resolved'

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

No branches or pull requests

1 participant