Skip to content

[PATCH] fix sv_usepvn_flags's docs #13835

Description

@p5pRT

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

Searchable as RT121869$

Activity

  1. p5pRT commented on May 14, 2014

    @p5pRT
    Author

    From @bulk88

    Created by @bulk88

    See attached patch. I'd like this in for 5.20 since #116925
    "document/publicize THINKFIRST" is stalled/bikeshedding and probably
    won't correct this big mistake in the docs for sv_usepvn_flags.

    Perl Info
    
    Flags:
                   category=core
                   severity=low
    
    Site configuration information for perl 5.19.7:
    
    Configured by Owner at Thu Nov 28 02:32:44 2013.
    
    Summary of my perl5 (revision 5 version 19 subversion 7) configuration:
                 Derived from: 8f47723e28b75530b743941cdd8b07f849ec48e2
                 Ancestor: 1061065f7a09399eefb50e9a035502621722bcc0
                 Platform:
                   osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
                   uname=''
                   config_args='undef'
                   hint=recommended, useposix=true, d_sigaction=undef
                   useithreads=define, usemultiplicity=define
                   useperlio=define, d_sfio=undef, uselargefiles=define,
    usesocks=undef
                   use64bitint=undef, use64bitall=undef, uselongdouble=undef
                   usemymalloc=n, bincompat5005=undef
                 Compiler:
                   cc='cl', ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG
    -G7 -GL
    -DWIN32 -D_CONSOLE -DNO_STRICT  -DPERL_TEXTMODE_SCRIPTS
    -DPERL_HASH_FUNC_ONE_AT_A_TIME -DPERL_IMPLICIT_CONTEXT
    -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T',
                   optimize='-O1 -MD -Zi -DNDEBUG -G7 -GL',
                   cppflags='-DWIN32'
                   ccversion='13.10.6030', gccversion='', gccosandvers=''
                   intsize=4, longsize=4, ptrsize=4, doublesize=8, 
    byteorder=1234
                   d_longlong=undef, longlongsize=8, d_longdbl=define,
    longdblsize=8
                   ivtype='long', ivsize=4, nvtype='double', nvsize=8,
    Off_t='__int64',
    lseeksize=8
                   alignbytes=8, prototype=define
                 Linker and Libraries:
                   ld='link', ldflags ='-nologo -nodefaultlib -debug 
    -opt:ref,icf
    -ltcg  -libpath:"c:\perl519\lib\CORE"  -machine:x86'
                   libpth="C:\Program Files\Microsoft Visual Studio .NET
    2003\VC7\lib"
                   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 ws2_32.lib mpr.lib winmm.lib  version.lib
    odbc32.lib odbccp32.lib comctl32.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 ws2_32.lib mpr.lib winmm.lib
    version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
                   libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl519.lib
                   gnulibc_version=''
                 Dynamic Linking:
                   dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
                   cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug
    -opt:ref,icf -ltcg  -libpath:"c:\perl519\lib\CORE"  -machine:x86'
    
    Locally applied patches:
                   uncommitted-changes
                   8f47723e28b75530b743941cdd8b07f849ec48e2
    
    
    @INC for perl 5.19.7:
                   C:/perl519/site/lib
                   C:/perl519/lib
                   .
    
    
    Environment for perl 5.19.7:
                   HOME (unset)
                   LANG (unset)
                   LANGUAGE (unset)
                   LD_LIBRARY_PATH (unset)
                   LOGDIR (unset)
                   PATH=C:\perl519\bin;C:\Program Files\Microsoft Visual Studio
    .NET
    2003\Common7\IDE;C:\Program Files\Microsoft Visual Studio .NET
    2003\VC7\BIN;C:\Program Files\Microsoft Visual Studio .NET
    2003\Common7\Tools;C:\Program Files\Microsoft Visual Studio .NET
    2003\Common7\Tools\bin\prerelease;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;
                   PERL_BADLANG (unset)
                   SHELL (unset)
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  2. p5pRT commented on May 14, 2014

    @p5pRT
    Author

    From @bulk88

    0001-fix-sv_usepvn_flags-s-docs.patch
    From 6a80a09ff167581a49ad3d65db8030fe03bcd823 Mon Sep 17 00:00:00 2001
    From: Daniel Dragan <bulk88@hotmail.com>
    Date: Wed, 14 May 2014 04:08:13 -0400
    Subject: [PATCH 1/2] fix sv_usepvn_flags's docs
    
    Newx != malloc, mixing Newx and malloc leads to heap corruption on some
    builds like Win32, use the official Perl API for allocating memory.
    ---
     sv.c |   10 ++++++----
     1 files changed, 6 insertions(+), 4 deletions(-)
    
    diff --git a/sv.c b/sv.c
    index 1005313..b43fadf 100644
    --- a/sv.c
    +++ b/sv.c
    @@ -4846,10 +4846,12 @@ Perl_sv_sethek(pTHX_ SV *const sv, const HEK *const hek)
     Tells an SV to use C<ptr> to find its string value.  Normally the
     string is stored inside the SV but sv_usepvn allows the SV to use an
     outside string.  The C<ptr> should point to memory that was allocated
    -by C<malloc>.  It must be the start of a mallocked block
    -of memory, and not a pointer to the middle of it.  The
    -string length, C<len>, must be supplied.  By default
    -this function will realloc (i.e. move) the memory pointed to by C<ptr>,
    +by L<Newx|perlclib/Memory Management and String Handling>. It must be
    +the start of a Newx-ed block of memory, and not a pointer to the
    +middle of it (beware of L<OOK|perlguts/Offsets> and copy-on-write),
    +and not be from a non-Newx memory allocator like C<malloc>. The
    +string length, C<len>, must be supplied.  By default this function
    +will C<Renew> (i.e. realloc, move) the memory pointed to by C<ptr>,
     so that pointer should not be freed or used by the programmer after
     giving it to sv_usepvn, and neither should any pointers from "behind"
     that pointer (e.g. ptr + 1) be used.
    -- 
    1.7.9.msysgit.0
    
    
  3. p5pRT commented on May 15, 2014

    @p5pRT
    Author

    From @tonycoz

    On Wed May 14 01​:30​:51 2014, bulk88 wrote​:

    This is a bug report for perl from bulk88@​hotmail.com,
    generated with the help of perlbug 1.39 running under perl 5.19.7.

    -----------------------------------------------------------------
    [Please describe your issue here]

    See attached patch. I'd like this in for 5.20 since #116925
    "document/publicize THINKFIRST" is stalled/bikeshedding and probably
    won't correct this big mistake in the docs for sv_usepvn_flags.

    Added as a 5.21.1 blocker.

    Tony

  4. p5pRT commented on May 15, 2014

    @p5pRT
    Author

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

  5. p5pRT commented on May 28, 2014

    @p5pRT
    Author

    From @tsee

    Thank you, applied as 461a975.

  6. p5pRT commented on May 28, 2014

    @p5pRT
    Author

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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions