-
Notifications
You must be signed in to change notification settings - Fork 560
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
[PATCH] fix sv_usepvn_flags's docs #13835
Comments
From @bulk88Created by @bulk88See attached patch. I'd like this in for 5.20 since #116925 Perl Info
|
From @bulk880001-fix-sv_usepvn_flags-s-docs.patchFrom 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
|
From @tonycozOn Wed May 14 01:30:51 2014, bulk88 wrote:
Added as a 5.21.1 blocker. Tony |
The RT System itself - Status changed from 'new' to 'open' |
@tsee - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#121869 (status was 'resolved')
Searchable as RT121869$
The text was updated successfully, but these errors were encountered: