delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2016/06/20/13:31:18

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20120113;
h=mime-version:from:date:message-id:subject:to;
bh=/SviYtqVTXtoemXBjGQiut3pVYaRXqYZd8XFtYTyU+o=;
b=RaxUM0Tj1/V13mVJSe+w1Lq/SOvg5I7nAGbCi1aMLEta+4vJ79V02ak14kn9QdffVP
sbZtHwIOfffP47PbvB9JZcHAqyFsJslp9GvjWvo2fBzAG0Kuwx0mkqXJ2GbiTVdGqgeM
H7BmUvDt2MCf2mR8yImjCOqGDyaaGy2SQXkC5KdID97ETq5PfSnAICRRNl5fbVTfseWn
B+kt78r4rP5TRkCF8EEq6Yd3cgO8KqOaHxkFKkGLiyqZXOr8ewP5awuOIRjvp9tvEEDN
2r9Bt7htygcCN7ee9unROTyzH916nVsVgJMr9vByJo+ykt+fKKXlKZTcxwztiAiQAB0l
qQzA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
bh=/SviYtqVTXtoemXBjGQiut3pVYaRXqYZd8XFtYTyU+o=;
b=HTeQ31R8HApkJsxB6muNcLTusnc3gHTsDSXq5Uh+JZSt95aZ4/DFEE5DNBhgavVJaf
C5Ei7AkC8p8XwznQS/x5qtL9YiBcsmp6qLiAUn3H+H2gvVn4omBnkHJkFtZCpVtnE/fs
iQtt9pH2zF8eQ0rMkxehQgyM3U2+eO2sfIryWLp8v3Yya+oBuoiLDGpvIX3ZZNztRROl
+2Wp+UEfVuqPpcZ7TBHhmyF6nqkd433j9PNu9X34G5Qd7OFoG6/NOaQ9vp4Cbo0hipNF
0ttvTW4Pd2O9X20q0+FEnE4EcVk5gAORXyPK64LuwIKUtzCJE7Uuh5ZFwa+6sJlpstN+
P7kw==
X-Gm-Message-State: ALyK8tJQaQ7sAglKcXqRx+hCTvrm/bgBZ+lWwyuImd4S/Z1jzpr6rlR6VcXsbI37GUglDWi1WCyuJFiL0xV/Eg==
X-Received: by 10.36.29.81 with SMTP id 78mr413155itj.97.1466442236726; Mon,
20 Jun 2016 10:03:56 -0700 (PDT)
MIME-Version: 1.0
From: "Ozkan Sezer (sezeroz AT gmail DOT com) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
Date: Mon, 20 Jun 2016 20:03:56 +0300
Message-ID: <CAA2C=vBRLP7tVyDOEc4MwANpALXuBPqt=Xxs+-Rxduy-q=WjBQ@mail.gmail.com>
Subject: djtar/unlzh.c bug introduced by whitespace changes
To: djgpp <djgpp AT delorie DOT com>
Reply-To: djgpp AT delorie DOT com

While reading the recent gcc6/-Wmisleading-intentation changes, I
noticed that in read_pt_len() of src/utils/djtar/unlzh.c, the
whitespace changes from 2012 (cvs r1.3 by Juan), a bug was intoduced,
where c should be incremented in every iteration of the while loop it
is now incremented strictly as once. The original code was:
		while (mask & bitbuf) {  mask >>= 1;  c++;  }

I suggest applying the following patch:

Index: unlzh.c
===================================================================
RCS file: /cvs/djgpp/djgpp/src/utils/djtar/unlzh.c,v
retrieving revision 1.6
diff -u -p -r1.6 unlzh.c
--- unlzh.c	20 Apr 2016 21:45:00 -0000	1.6
+++ unlzh.c	20 Jun 2016 17:01:28 -0000
@@ -237,8 +237,10 @@ local void read_pt_len(int nn, int nbit,
       {
         mask = (unsigned) 1 << (BITBUFSIZ - 1 - 3);
         while (mask & bitbuf)
+        {
           mask >>= 1;
-        c++;
+          c++;
+        }
       }
       fillbuf((c < 7) ? 3 : c - 3);
       pt_len[i++] = c;


OK?

--
O.S.

P.S.: I don't know whether there are any other bugs sneaked in via
those whitespace changes. May be worth investigating:  cvs diff -w
would be helpful.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019