Change 27340 by [EMAIL PROTECTED] on 2006/02/27 14:19:32

        There is now the potential for an upgrade from something without an
        offset (PVNV or PVMG) to something with one (PVCV, PVFM). Deal with
        this correctly.

Affected files ...

... //depot/perl/sv.c#1175 edit

Differences ...

==== //depot/perl/sv.c#1175 (text) ====
Index: perl/sv.c
--- perl/sv.c#1174~27339~       2006-02-27 05:40:44.000000000 -0800
+++ perl/sv.c   2006-02-27 06:19:32.000000000 -0800
@@ -1351,9 +1351,21 @@
        SvANY(sv) = new_body;
 
        if (old_type_details->copy) {
-           Copy((char *)old_body + old_type_details->offset,
-                (char *)new_body + old_type_details->offset,
-                old_type_details->copy, char);
+           /* There is now the potential for an upgrade from something without
+              an offset (PVNV or PVMG) to something with one (PVCV, PVFM)  */
+           int offset = old_type_details->offset;
+           int length = old_type_details->copy;
+
+           if (new_type_details->offset > old_type_details->offset) {
+               int difference
+                   = new_type_details->offset - old_type_details->offset;
+               offset += difference;
+               length -= difference;
+           }
+           assert (length >= 0);
+               
+           Copy((char *)old_body + offset, (char *)new_body + offset, length,
+                char);
        }
 
 #ifndef NV_ZERO_IS_ALLBITS_ZERO
End of Patch.

Reply via email to