On Thursday, Feb 27, 2003, at 16:56 Asia/Tokyo, Dan Kogai wrote: > On Wednesday, Feb 26, 2003, at 14:49 Asia/Tokyo, Craig A. Berry wrote: >> it seems like it would be a good idea to protect against that even if >> it's not supposed to happen. > > I do agree with that. The question is how... Craig, Would you try the patch below ? Instead of typecasting I now made sure that slen is never negative. Already passed 'make test' here. --- Encode.xs 2003/02/20 14:42:34 1.54 +++ Encode.xs 2003/02/27 09:32:04 @@ -78,11 +78,15 @@ if (offset) { s += *offset; - slen -= *offset; + if (slen > *offset){ /* safegurd against slen overflow */ + slen -= *offset; + }else{ + slen = 0; + } tlen = slen; } - if (slen <= 0){ + if (slen == 0){ SvCUR_set(dst, 0); SvPOK_only(dst); goto ENCODE_END; __END_OF_PATCH__ (U8 *)"Dan the Encode Maintainer";Thread Previous | Thread Next