File: patch-4

package info (click to toggle)
afio 2.4.7-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 372 kB
  • ctags: 403
  • sloc: ansic: 4,238; sh: 226; makefile: 64
file content (63 lines) | stat: -rw-r--r-- 1,985 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
To: Michael Zieger <m.zieger@zmi.at>
cc: Koen Holtman <koen@hep.caltech.edu>, bl@pluto.i.zmi.at, edd@debian.org
Subject: Re: !!! Bug found in AFIO (afio: Version 2.4.5 dated 28 Sep 1998)
Date: Wed, 3 Jan 2001 06:34:38 -0800 (PST)



Hi Michael,

I finally found some time to look into the cause of the bug you
reported.  Turns out that it was due to a cast that sometimes lost
information.  For the record, the bug is unrelated to whether or not
you use -f.  Using -s35000m in stead of -s35g avoids triggering the
bug because 35000m is not really equal to 35g, but a factor 1024/1000
less, so you use another number that somehow avoids the situation
in which the cast is a problem.

I include a patch file for the bug below.  I'f you'd rather have a
complete afio.c file, tell me.  I expect to release an updated afio
version that includes this patch in the near future, i.e. within 1-3
months.

Thanks again for reporting the bug and giving me the examples I needed
to solve it.

Cheers,

Koen.



--- ../afio.2.4.6/afio.c        Fri Nov 26 01:24:39 1999
+++ afio.c      Wed Jan  3 15:23:54 2001
@@ -1586,6 +1586,7 @@
 {
   reg int got;
   static int failed;
+  ulonglong ullreadsize;
   off_t readsize;
 
   bufend = bufidx = buffer;
@@ -1602,13 +1603,16 @@
                fatal (arspec, "Premature input EOF");      
        }
 #if 0
-    fprintf(stderr,"aruntil=%ld arleft=%ld arbsize=%ld\n",(off_t)aruntil,(off_t)arleft,arbsize);
+    fprintf(stderr,"aruntil=%Ld arleft=%Ld=0x%Lx arbsize=%d\n",aruntil,arleft,arleft,arbsize);
 #endif
       if (aruntil && (arleft == 0))
        next (O_RDONLY, "Input limit reached");
       
-      if(aruntil) readsize=(off_t)arleft; else readsize=buffer + buflen - bufend;
-      if(readsize>arbsize) readsize=arbsize;
+      if(aruntil) ullreadsize=arleft; else ullreadsize=buffer + buflen - bufend;
+
+      if(ullreadsize>arbsize) ullreadsize=arbsize;
+
+      readsize=(off_t)ullreadsize;
 
       while (!failed
             && !areof