Skip Menu |
Report information
Id: 121869
Status: resolved
Priority: 0/
Queue: perl5

Owner: smueller [at] cpan.org
Requestors: bulk88 <bulk88 [at] hotmail.com>
Cc:
AdminCc:

Operating System: mswin32
PatchStatus: (no value)
Severity: low
Type: core
Perl Version: 5.19.7
Fixed In: (no value)

Attachments


To: perlbug [...] perl.org
Date: Wed, 14 May 2014 04:30:27 -0400
From: bulk88 <bulk88 [...] hotmail.com>
Subject: [PATCH] fix sv_usepvn_flags's docs
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. [Please do not change anything below this line] ----------------------------------------------------------------- --- 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)
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
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 514b
On Wed May 14 01:30:51 2014, bulk88 wrote: Show quoted text
> 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
RT-Send-CC: perl5-porters [...] perl.org
Thank you, applied as 461a975bd8196c522aeb2e0a06eb6980c25ffa2e.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org