Change 34604 by [EMAIL PROTECTED] on 2008/10/27 20:22:36

        Bugs revealed by replacing (SV *) casts with something that doesn't
        cast away const - AvFILL() doesn't guarantee that it won't modify the
        AV * passed to it. So the prototype for Perl_av_len() needs to change,
        and a const needs to go in Perl_magic_setarraylen().

Affected files ...

... //depot/perl/av.c#136 edit
... //depot/perl/embed.fnc#623 edit
... //depot/perl/mg.c#532 edit
... //depot/perl/proto.h#958 edit

Differences ...

==== //depot/perl/av.c#136 (text) ====
Index: perl/av.c
--- perl/av.c#135~34585~        2008-10-25 05:23:01.000000000 -0700
+++ perl/av.c   2008-10-27 13:22:36.000000000 -0700
@@ -758,7 +758,7 @@
 */
 
 I32
-Perl_av_len(pTHX_ register const AV *av)
+Perl_av_len(pTHX_ AV *av)
 {
     PERL_ARGS_ASSERT_AV_LEN;
     assert(SvTYPE(av) == SVt_PVAV);

==== //depot/perl/embed.fnc#623 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#622~34574~   2008-10-24 14:38:48.000000000 -0700
+++ perl/embed.fnc      2008-10-27 13:22:36.000000000 -0700
@@ -112,7 +112,7 @@
 pR     |AV*    |av_fake        |I32 size|NN SV **strp
 ApdR   |SV**   |av_fetch       |NN AV *av|I32 key|I32 lval
 Apd    |void   |av_fill        |NN AV *av|I32 fill
-ApdR   |I32    |av_len         |NN const AV *av
+ApdR   |I32    |av_len         |NN AV *av
 ApdR   |AV*    |av_make        |I32 size|NN SV **strp
 Apd    |SV*    |av_pop         |NN AV *av
 ApdoxM |void   |av_create_and_push|NN AV **const avp|NN SV *const val

==== //depot/perl/mg.c#532 (text) ====
Index: perl/mg.c
--- perl/mg.c#531~34585~        2008-10-25 05:23:01.000000000 -0700
+++ perl/mg.c   2008-10-27 13:22:36.000000000 -0700
@@ -1895,7 +1895,7 @@
 Perl_magic_getarylen(pTHX_ SV *sv, const MAGIC *mg)
 {
     dVAR;
-    const AV * const obj = (AV*)mg->mg_obj;
+    AV * const obj = (AV*)mg->mg_obj;
 
     PERL_ARGS_ASSERT_MAGIC_GETARYLEN;
 

==== //depot/perl/proto.h#958 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#957~34586~     2008-10-25 05:47:01.000000000 -0700
+++ perl/proto.h        2008-10-27 13:22:36.000000000 -0700
@@ -192,7 +192,7 @@
 #define PERL_ARGS_ASSERT_AV_FILL       \
        assert(av)
 
-PERL_CALLCONV I32      Perl_av_len(pTHX_ const AV *av)
+PERL_CALLCONV I32      Perl_av_len(pTHX_ AV *av)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_AV_LEN        \
End of Patch.

Reply via email to