aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2008-05-15 09:55:55 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2008-05-15 09:55:55 +0000
commitea5d13c2fb8aa92f299e37116623e3ef881c1296 (patch)
treec90d99a9c2dc890d23a8312083cfeae7f8034d8a
parentc4711d10e376605b3dcce187a5d7de718fe93ecf (diff)
downloadmailfromd-ea5d13c2fb8aa92f299e37116623e3ef881c1296.tar.gz
mailfromd-ea5d13c2fb8aa92f299e37116623e3ef881c1296.tar.bz2
Fixup C variables that point to dataseg after expanding it.
Bug reported by Sergey Afonin. * mfd/snarf.m4 (mf_c_argdcl): Produce only C declarations. (mf_c_arginit): New macro. (__mf_c_argdcl_list,__mf_c_arginit_list): New auxiliary macros. (__mf_c_arglist): Rewrite using the above macros. (mf_c_arglist,MF_VA_ARG): Reflect changes to get_.*_arg functions. * mfd/bi_sprintf.m4: Update invocations of MF_VA_ARG. * mfd/prog.c (struct eval_environ): New members auto_ptr and numautos. (env_register_auto, env_unregister_autos, env_fixup_autos): New functions. (expand_dataseg): Call env_fixup_autos. (get_literal, get_string_arg): Change signature. Call env_register_auto. All callers updated. (get_numeric_arg): Change signature for consistency with other get_ functions. All callers updated. (get_pointer_arg): New function. (eval_environment): Call env_unregister_autos after running each instruction. * mfd/prog.h (get_pointer_arg): New function. (get_string_arg, get_numeric_arg): Change prototypes. * mfd/bi_sieve.m4: Minor stylistic fix. * NEWS: Update. * mfd/drivers.c (code_cast): Handle dtype_pointer git-svn-id: file:///svnroot/mailfromd/trunk@1655 7a8a7f39-df28-0410-adc6-e0d955640f24
-rw-r--r--ChangeLog30
-rw-r--r--NEWS7
-rw-r--r--mfd/bi_sieve.m42
-rw-r--r--mfd/bi_sprintf.m419
-rw-r--r--mfd/drivers.c4
-rw-r--r--mfd/prog.c264
-rw-r--r--mfd/prog.h6
-rw-r--r--mfd/snarf.m470
8 files changed, 283 insertions, 119 deletions
diff --git a/ChangeLog b/ChangeLog
index 9267c9fd..3488c919 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
12008-05-15 Sergey Poznyakoff <gray@gnu.org.ua>
2
3 Fixup C variables that point to dataseg after expanding it.
4 Bug reported by Sergey Afonin.
5
6 * mfd/snarf.m4 (mf_c_argdcl): Produce only C declarations.
7 (mf_c_arginit): New macro.
8 (__mf_c_argdcl_list,__mf_c_arginit_list): New auxiliary macros.
9 (__mf_c_arglist): Rewrite using the above macros.
10 (mf_c_arglist,MF_VA_ARG): Reflect changes to get_.*_arg functions.
11 * mfd/bi_sprintf.m4: Update invocations of MF_VA_ARG.
12 * mfd/prog.c (struct eval_environ): New members auto_ptr and
13 numautos.
14 (env_register_auto, env_unregister_autos, env_fixup_autos): New
15 functions.
16 (expand_dataseg): Call env_fixup_autos.
17 (get_literal, get_string_arg): Change signature. Call
18 env_register_auto. All callers updated.
19 (get_numeric_arg): Change signature for consistency with other
20 get_ functions. All callers updated.
21 (get_pointer_arg): New function.
22 (eval_environment): Call env_unregister_autos after running each
23 instruction.
24 * mfd/prog.h (get_pointer_arg): New function.
25 (get_string_arg, get_numeric_arg): Change prototypes.
26 * mfd/bi_sieve.m4: Minor stylistic fix.
27 * NEWS: Update.
28
29 * mfd/drivers.c (code_cast): Handle dtype_pointer
30
12008-04-13 Sergey Poznyakoff <gray@gnu.org.ua> 312008-04-13 Sergey Poznyakoff <gray@gnu.org.ua>
2 32
3 * configure.ac: Require Mailutils 1.9.90 33 * configure.ac: Require Mailutils 1.9.90
diff --git a/NEWS b/NEWS
index 00d4c805..ff1eaaae 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,8 @@
1Mailfromd NEWS -- history of user-visible changes. 2008-04-13 1Mailfromd NEWS -- history of user-visible changes. 2008-05-15
2Copyright (C) 2005, 2006, 2007, 2008 Sergey Poznyakoff 2Copyright (C) 2005, 2006, 2007, 2008 Sergey Poznyakoff
3See the end of file for copying conditions. 3See the end of file for copying conditions.
4 4
5Please send Mailfromd bug reports to <bug-gmach@gnu.org.ua> 5Please send Mailfromd bug reports to <bug-mailfromd@gnu.org.ua>
6 6
7 7
8Version 4.9.92 (SVN) 8Version 4.9.92 (SVN)
@@ -161,7 +161,8 @@ name and a list of additional groups when the program is run with
161* Bugfixes 161* Bugfixes
162** Fix program evaluator bug that manifested itself on machines where 162** Fix program evaluator bug that manifested itself on machines where
163 sizeof(unsigned long) > sizeof(usnigned). 163 sizeof(unsigned long) > sizeof(usnigned).
164 164** Fix stack reallocation.
165
165 166
166Version 4.4, 2008-03-10 167Version 4.4, 2008-03-10
167 168
diff --git a/mfd/bi_sieve.m4 b/mfd/bi_sieve.m4
index e97acb60..d859a82a 100644
--- a/mfd/bi_sieve.m4
+++ b/mfd/bi_sieve.m4
@@ -152,7 +152,7 @@ MF_DEFUN(sieve, NUMBER, STRING script, OPTIONAL, NUMBER dbg)
152 mu_sieve_set_logger(mach, _sieve_action_log); 152 mu_sieve_set_logger(mach, _sieve_action_log);
153 153
154 rc = mu_sieve_compile(mach, script); 154 rc = mu_sieve_compile(mach, script);
155 if (rc == 0){ 155 if (rc == 0) {
156 mu_stream_t mstr = env_get_stream(env); 156 mu_stream_t mstr = env_get_stream(env);
157 mu_attribute_t attr; 157 mu_attribute_t attr;
158 mu_message_t msg; 158 mu_message_t msg;
diff --git a/mfd/bi_sprintf.m4 b/mfd/bi_sprintf.m4
index afd63d32..051d2dc4 100644
--- a/mfd/bi_sprintf.m4
+++ b/mfd/bi_sprintf.m4
@@ -150,8 +150,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
150 if (isdigit(*p)) { 150 if (isdigit(*p)) {
151 char *q = get_num(p, &n); 151 char *q = get_num(p, &n);
152 if (*q == '$') { 152 if (*q == '$') {
153 num = (unsigned) MF_VA_ARG(n-1, 153 MF_VA_ARG(n-1, NUMBER, num);
154 NUMBER);
155 p = q + 1; 154 p = q + 1;
156 if (num < 0) { 155 if (num < 0) {
157 flags |= FMT_SPACEPFX; 156 flags |= FMT_SPACEPFX;
@@ -161,7 +160,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
161 break; 160 break;
162 } 161 }
163 } 162 }
164 num = MF_VA_ARG(i, NUMBER); 163 MF_VA_ARG(i, NUMBER, num);
165 i++; 164 i++;
166 if (num < 0) { 165 if (num < 0) {
167 /* A negative field width is taken 166 /* A negative field width is taken
@@ -193,14 +192,14 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
193 if (isdigit(*p)) { 192 if (isdigit(*p)) {
194 char *q = get_num(p, &n); 193 char *q = get_num(p, &n);
195 if (*q == '$') { 194 if (*q == '$') {
196 num = MF_VA_ARG(n-1, NUMBER); 195 MF_VA_ARG(n-1, NUMBER, num);
197 if (num > 0) 196 if (num > 0)
198 prec = (unsigned) num; 197 prec = (unsigned) num;
199 p = q + 1; 198 p = q + 1;
200 break; 199 break;
201 } 200 }
202 } 201 }
203 num = MF_VA_ARG(i, NUMBER); 202 MF_VA_ARG(i, NUMBER, num);
204 i++; 203 i++;
205 if (num > 0) 204 if (num > 0)
206 prec = (unsigned) num; 205 prec = (unsigned) num;
@@ -211,7 +210,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
211 argnum = i++; 210 argnum = i++;
212 switch (*p) { 211 switch (*p) {
213 case 's': 212 case 's':
214 str = MF_VA_ARG(argnum,STRING); 213 MF_VA_ARG(argnum, STRING, str);
215 n = strlen(str); 214 n = strlen(str);
216 if (prec && prec < n) 215 if (prec && prec < n)
217 n = prec; 216 n = prec;
@@ -235,7 +234,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
235 234
236 case 'i': 235 case 'i':
237 case 'd': 236 case 'd':
238 num = MF_VA_ARG(argnum,NUMBER); 237 MF_VA_ARG(argnum, NUMBER, num);
239 if (num < 0) { 238 if (num < 0) {
240 negative = 1; 239 negative = 1;
241 num = - num; 240 num = - num;
@@ -290,7 +289,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
290 break; 289 break;
291 290
292 case 'u': 291 case 'u':
293 num = MF_VA_ARG(argnum,NUMBER); 292 MF_VA_ARG(argnum, NUMBER, num);
294 /* If a precision is given with a 293 /* If a precision is given with a
295 numeric conversion, the 0 flag is ignored. 294 numeric conversion, the 0 flag is ignored.
296 */ 295 */
@@ -323,7 +322,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
323 322
324 case 'x': 323 case 'x':
325 case 'X': 324 case 'X':
326 num = MF_VA_ARG(argnum,NUMBER); 325 MF_VA_ARG(argnum, NUMBER, num);
327 /* If a precision is given with a 326 /* If a precision is given with a
328 numeric conversion, the 0 flag is ignored. 327 numeric conversion, the 0 flag is ignored.
329 */ 328 */
@@ -369,7 +368,7 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
369 break; 368 break;
370 369
371 case 'o': 370 case 'o':
372 num = MF_VA_ARG(argnum,NUMBER); 371 MF_VA_ARG(argnum, NUMBER, num);
373 /* If a precision is given with a 372 /* If a precision is given with a
374 numeric conversion, the 0 flag is ignored. 373 numeric conversion, the 0 flag is ignored.
375 */ 374 */
diff --git a/mfd/drivers.c b/mfd/drivers.c
index 72c3b898..2263a9ed 100644
--- a/mfd/drivers.c
+++ b/mfd/drivers.c
@@ -2163,6 +2163,10 @@ code_cast(struct locus *locus, data_type_t fromtype, data_type_t totype)
2163 case dtype_number: 2163 case dtype_number:
2164 code_op(opcode_ntos); 2164 code_op(opcode_ntos);
2165 break; 2165 break;
2166
2167 case dtype_pointer:
2168 parse_error_locus(locus,
2169 _("Casts from pointer are not supported"));
2166 } 2170 }
2167 return 0; 2171 return 0;
2168} 2172}
diff --git a/mfd/prog.c b/mfd/prog.c
index 4ed93099..6b869320 100644
--- a/mfd/prog.c
+++ b/mfd/prog.c
@@ -233,6 +233,10 @@ disable_prog_trace(const char *modlist)
233 233
234/* Run-time evaluation */ 234/* Run-time evaluation */
235 235
236/* Max. number of C locals to save in struct eval_environ for eventual fixups.
237 See comment to env_fixup_autos, below. */
238#define MAX_AUTO_PTR 128
239