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

usemymalloc cannot handle long strings #13273

Closed
p5pRT opened this issue Sep 15, 2013 · 4 comments
Closed

usemymalloc cannot handle long strings #13273

p5pRT opened this issue Sep 15, 2013 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 15, 2013

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

Searchable as RT119829$

@p5pRT
Copy link
Author

p5pRT commented Sep 15, 2013

From @cpansprout

usemymalloc cannot handle long strings

$ ./perl -Ilib -e 'my $x=" "x(${\2}**31+20);'
Segmentation fault​: 11

(gdb) bt
#0 0x000000010007ac70 in fill_pat_4bytes (s=0x1009eda00 "ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??ޭ??"..., nbytes=2147487744, fill=0x1004a9840 "ޭ??ޭ??ޭ??ޭ??????????????????AUTOLOAD") at malloc.c​:1158
#1 0x000000010007a51f in morecore (bucket=31) at malloc.c​:1772
#2 0x00000001000793ec in Perl_malloc (nbytes=2147479588) at malloc.c​:1287
#3 0x000000010007bcd7 in Perl_realloc (mp=0x1009a9468, nbytes=2147483670) at malloc.c​:2097
#4 0x000000010025d62c in Perl_sv_grow (my_perl=0x100803200, sv=0x100997460, newlen=2147483670) at sv.c​:1532
#5 0x000000010030b6b7 in Perl_pp_repeat (my_perl=0x100803200) at pp.c​:1729
#6 0x00000001001b016c in Perl_runops_debug (my_perl=0x100803200) at dump.c​:2261
#7 0x0000000100060702 in S_run_body (my_perl=0x100803200, oldscope=1) at perl.c​:2500
#8 0x000000010005f6d5 in perl_run (my_perl=0x100803200) at perl.c​:2416
#9 0x0000000100001428 in main (argc=3, argv=0x7fff5fbffa80, env=0x7fff5fbffaa0) at perlmain.c​:112

For me, it happens with any number larger than 1073745906.

$ ./perl -Ilib -e 'my $x=" "x 1073745907'
Segmentation fault​: 11

I am also compiling with mad+threads, if that makes any difference.

Summary of my perl5 (revision 5 version 19 subversion 3) configuration​:
  Commit id​: a496ca38c9dd66846ae327cc193078aee36ae004
  Platform​:
  osname=darwin, osvers=12.2.0, archname=darwin-thread-multi-2level
  uname='darwin pint.local 12.2.0 darwin kernel version 12.2.0​: sat aug 25 00​:48​:52 pdt 2012; root​:xnu-2050.18.24~1release_x86_64 x86_64 '
  config_args='-Dusemymalloc -Duseithreads -Dmad -de -Dusedevel -Doptimize=-ggdb3 -Aoptimize=-O0 -DDEBUGGING'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=define, usemultiplicity=define
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=y, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-fno-common -DPERL_DARWIN -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include',
  optimize='-ggdb3 -O0',
  cppflags='-fno-common -DPERL_DARWIN -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.27)', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib
  libs=-ldbm -ldl -lm -lutil -lc
  perllibs=-ldl -lm -lutil -lc
  libc=, so=dylib, useshrplib=false, libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector'

Characteristics of this binary (from libperl)​:
  Compile-time options​: DEBUGGING HAS_TIMES MULTIPLICITY MYMALLOC
  PERLIO_LAYERS PERL_DONT_CREATE_GVSV
  PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
  PERL_IMPLICIT_CONTEXT PERL_MAD PERL_MALLOC_WRAP
  PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
  PERL_TRACK_MEMPOOL PERL_USE_DEVEL USE_64_BIT_ALL
  USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
  USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
  USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
  USE_REENTRANT_API
  Built under darwin
  Compiled at Aug 11 2013 14​:54​:13
  @​INC​:
  lib
  /usr/local/lib/perl5/site_perl/5.19.3/darwin-thread-multi-2level
  /usr/local/lib/perl5/site_perl/5.19.3
  /usr/local/lib/perl5/5.19.3/darwin-thread-multi-2level
  /usr/local/lib/perl5/5.19.3
  /usr/local/lib/perl5/site_perl
  .

@p5pRT
Copy link
Author

p5pRT commented Dec 1, 2017

From zefram@fysh.org

Fixed in commit 64072da.

-zefram

@p5pRT
Copy link
Author

p5pRT commented Dec 1, 2017

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

@p5pRT
Copy link
Author

p5pRT commented Dec 1, 2017

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

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