From: Vincent Pit Date: Mon, 28 Dec 2009 18:25:11 +0000 (+0100) Subject: Explicitely cap the op_info parameter to 255 X-Git-Tag: v0.40~11 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=cd2cbc62bac1de874dfc366031de9b10b852defb;p=perl%2Fmodules%2FVariable-Magic.git Explicitely cap the op_info parameter to 255 --- diff --git a/Magic.xs b/Magic.xs index f26774d..edddac8 100644 --- a/Magic.xs +++ b/Magic.xs @@ -1340,6 +1340,7 @@ SV *_wizard(...) PROTOTYPE: DISABLE PREINIT: I32 i = 0; + UV opinfo; MGWIZ *w; MGVTBL *t; SV *cb; @@ -1365,10 +1366,13 @@ CODE: Newx(w, 1, MGWIZ); VMG_SET_CB(ST(i++), data); + cb = ST(i++); - w->opinfo = SvOK(cb) ? SvUV(cb) : 0; + opinfo = SvOK(cb) ? SvUV(cb) : 0; + w->opinfo = (U8) ((opinfo < 255) ? opinfo : 255); if (w->opinfo) vmg_op_info_init(w->opinfo); + VMG_SET_SVT_CB(ST(i++), get); VMG_SET_SVT_CB(ST(i++), set); VMG_SET_SVT_CB(ST(i++), len);