summaryrefslogtreecommitdiff
blob: 080bcf8f1675ef8d416e09790ef89ad4406eb500 (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
diff -Naur wv/escher.c wv.mod/escher.c
--- wv/escher.c	Wed Apr 11 01:27:47 2001
+++ wv.mod/escher.c	Wed Jan 16 13:33:08 2002
@@ -215,8 +215,7 @@
 		count +=
 		    wvGetSpgrContainer (&
 					(item->spgrcontainer
-					 [item->no_spgrcontainer - 1]),
-&amsofbh, fd);
+					 [item->no_spgrcontainer - 1]), &amsofbh, fd);
 		break;
 	    default:
 		count += wvEatmsofbt (&amsofbh, fd);
@@ -303,8 +302,7 @@
 		count +=
 		    wvGetSpgrContainer (&
 					(item->spgrcontainer
-					 [item->no_spgrcontainer - 1]),
-&amsofbh, fd);
+					 [item->no_spgrcontainer - 1]), &amsofbh, fd);
 		break;
 	    default:
 		count += wvEatmsofbt (&amsofbh, fd);
@@ -684,10 +682,14 @@
 U32
 wvEatmsofbt (MSOFBH * amsofbh, wvStream * fd)
 {
+    /* Ries (rvt@dds.nl)
+       Changed read to bound to 32bit instead of 8bit 
+       MS prolly does 32 bit bounderaries ??? */
     U32 i;
-    for (i = 0; i < amsofbh->cbLength; i++)
-	read_8ubit (fd);
-    return (amsofbh->cbLength);
+    U32 check=(amsofbh->cbLength + 3) >> 2;
+    for (i = 0; i < check; i++)
+	read_32ubit (fd);
+    return (check << 2);
 }
 
 void
diff -Naur wv/picf.c wv.mod/picf.c
--- wv/picf.c	Wed Jan  2 20:33:34 2002
+++ wv.mod/picf.c	Wed Jan 16 13:33:08 2002
@@ -218,13 +218,19 @@
 		break;
 	    default:
 		{
-		    U32 len = entry - 2;
+		    U32 lene2 = entry - 2;
 		    U32 i;
 		    wvTrace (
-			     ("len is %d, predict end of %x\n", len,
+			     ("lene2 is %d, predict end of %x\n", len,
 			      wvStream_tell (fd) + (entry - 2) * 2));
-		    for (i = 0; i < len; i++)
+		    /* RIES (rvt@dds.nl)
+		       prolly a dirty patch because I check count
+		       everytime it's incremnented against lene2.
+		       This seems twork very well I tried it on around 15.000
+		       word documents and it seems to work! */
+		    for (i = 0; i < lene2; i++)
 		      {
+		          if ( (count + 1) >= len) return (count);
 			  test = read_16ubit (fd);
 			  if ((i == 0)
 			      && ((test == 0x0f43) || (test == 0x0b41)))
@@ -232,11 +238,13 @@
 				wvTrace (
 					 ("Found a Bitmap, Will strip header and return with bitmap data\n"));
 				count += 2;
+    		        	if ( (count + 1) >= len) return (count);
 				pad = test;
 				test = read_32ubit (fd);	/*0x00cc0020 */
 				if (test != 0x00cc0020)
 				    wvTrace (("Old Graphic\n"));
 				count += 4;
+    		        	if ( (count + 1) >= len) return (count);
 
 				if (pad == 0x0f43)
 				  {
@@ -244,20 +252,26 @@
 				      if (test != 0x0000)
 					  wvTrace (("Old Graphic\n"));
 				      count += 2;
+			              if ( (count + 1) >= len) return (count);
 				  }
 
 				read_16ubit (fd);	/*width */
 				count += 2;
+    		        	if ( (count + 1) >= len) return (count);
 				read_16ubit (fd);	/*height */
 				count += 2;
+    		        	if ( (count + 1) >= len) return (count);
 				test = read_32ubit (fd);	/*0x00000000L */
 				if (test != 0x00000000L)
 				    wvTrace (("Old Graphic\n"));
 				count += 4;
+    		        	if ( (count + 1) >= len) return (count);
 				read_16ubit (fd);	/*width */
 				count += 2;
+    		        	if ( (count + 1) >= len) return (count);
 				read_16ubit (fd);	/*height */
 				count += 2;
+    		        	if ( (count + 1) >= len) return (count);
 				test = read_32ubit (fd);	/*0x00000000L */
 				if (test != 0x00000000L)
 				    wvTrace (("Old Graphic\n"));
@@ -265,6 +279,7 @@
 				return (count);
 			    }
 			  count += 2;
+	        	  if ( (count + 1) >= len) return (count);
 		      }
 		}
 		break;
diff -Naur wv/wvText.in wv.mod/wvText.in
--- wv/wvText.in	Sun Mar 11 20:00:24 2001
+++ wv.mod/wvText.in	Wed Jan 16 13:33:08 2002
@@ -3,6 +3,7 @@
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 datadir=@datadir@
+tmpdir=/tmp
 
 # argument checking
 if [ ${#} -ne "2" ]; then
@@ -29,23 +30,23 @@
     fi
 
     # intermediate file
-    TMP_FILE="/tmp/wv$$.html"
+    TMP_FILE="wv$$.html"
 
-    wvHtml "${1}" "${TMP_FILE}" >/dev/null 2>&1
+    wvHtml "${1}" --targetdir="${tmpdir}" "${TMP_FILE}" >/dev/null 2>&1
     if [ ${?} -ne "0" ]; then
 	echo "Could not convert into HTML"
 	exit 1
     fi
 
     # lynx actually does quite well
-    TERM=vt100 lynx -dump -force_html "${TMP_FILE}" > "${2}"
+    TERM=vt100 lynx -dump -force_html "${tmpdir}/${TMP_FILE}" > "${2}"
     if [ ${?} -ne "0" ]; then
 	    echo "Could not convert into Text"
 	    exit 1
     fi
 
     # clean up
-    rm -f ${TMP_FILE}
+    rm -f "${tmpdir}/${TMP_FILE}"
 
 else
     # fall back onto our cruddy output