develooper Front page | perl.perl5.porters | Postings from February 2003

Re: remaining signedness issue in Encode 1.88

Thread Previous | Thread Next
From:
Dan Kogai
Date:
February 27, 2003 01:37
Subject:
Re: remaining signedness issue in Encode 1.88
Message ID:
14E13521-4A37-11D7-BB3D-000393AE4244@dan.co.jp
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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About