List Info

Thread: Fix illegal memory access in Hash::Util::FieldHash




Fix illegal memory access in Hash::Util::FieldHash
user name
2007-10-09 06:00:05
valgrind revealed a case of illegal memory access while
running
ext/Hash/Util/FieldHash/t/02_function.t. The following
change fixed
it, I'm posting it here for review, since that part of the
code isn't
very familiar to me...

Change 32075 by rgsstcosmo on 2007/10/09 10:56:56

	Free temporary scalars later, because they might be still
needed
	when retoring magic

Affected files ...

... //depot/perl/ext/Hash/Util/FieldHash/FieldHash.xs#17
edit

Differences ...

==== //depot/perl/ext/Hash/Util/FieldHash/FieldHash.xs#17
(text) ====

 -127,12
+127,12 
         while (ent = hv_iternext(field_tab)) {
             SV* field_ref = HeVAL(ent);
             SV* field = SvRV(field_ref);
-            hv_delete_ent((HV*)field, ob_id, G_DISCARD,
0);
+            hv_delete_ent((HV*)field, ob_id, 0, 0);
         }
         /* make it safe in case we must run in global
clenaup, after all */
         if (PL_in_clean_all)
             HUF_global(HUF_RESET); /* shoudn't be needed
*/
-        hv_delete_ent(MY_CXT.ob_reg, ob_id, G_DISCARD, 0);
+        hv_delete_ent(MY_CXT.ob_reg, ob_id, 0, 0);
     }
     return 0;
 }

Re: Fix illegal memory access in Hash::Util::FieldHash
user name
2007-10-09 16:58:59
On 09.10.2007, at 13:00, Rafael Garcia-Suarez wrote:

> valgrind revealed a case of illegal memory access while
running
> ext/Hash/Util/FieldHash/t/02_function.t. The following
change fixed
> it, I'm posting it here for review, since that part of
the code isn't
> very familiar to me...

I'm not sure what valgrind is complaining about, nor why the
change  
fixes
it, but the change can't hurt anything I could see.

Anno

> Change 32075 by rgsstcosmo on 2007/10/09
10:56:56
>
> 	Free temporary scalars later, because they might be
still needed
> 	when retoring magic
>
> Affected files ...
>
> ...
//depot/perl/ext/Hash/Util/FieldHash/FieldHash.xs#17 edit
>
> Differences ...
>
> ====
//depot/perl/ext/Hash/Util/FieldHash/FieldHash.xs#17 (text)
====
>
>  -127,12 +127,12 
>          while (ent = hv_iternext(field_tab)) {
>              SV* field_ref = HeVAL(ent);
>              SV* field = SvRV(field_ref);
> -            hv_delete_ent((HV*)field, ob_id,
G_DISCARD, 0);
> +            hv_delete_ent((HV*)field, ob_id, 0, 0);
>          }
>          /* make it safe in case we must run in global
clenaup,  
> after all */
>          if (PL_in_clean_all)
>              HUF_global(HUF_RESET); /* shoudn't be
needed */
> -        hv_delete_ent(MY_CXT.ob_reg, ob_id, G_DISCARD,
0);
> +        hv_delete_ent(MY_CXT.ob_reg, ob_id, 0, 0);
>      }
>      return 0;
>  }




[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )