\S{cl-2.09} Version 2.09
+\b Fixed assignment the magnitude of \c{%rep} counter. It is limited
+ to 62 bits now.
+
\b Fixed NULL dereference if argument of \c{%strlen} resolves
to whitespace. For example if nonexistent macro parameter is used.
multi-user systems) would typically cause all the system memory to
be gradually used up and other applications to start crashing.
+Note a maximum repeat count is limited by 62 bit number, though it
+is hardly possible that you ever need anything bigger.
+
\H{files} Source Files and Dependencies
*/
#define DEADMAN_LIMIT (1 << 20)
+/* max reps */
+#define REP_LIMIT ((INT64_C(1) << 62))
+
/*
* Condition codes. Note that we use c_ prefix not C_ because C_ is
* used in nasm.h for the "real" condition codes. At _this_ level,
error(ERR_NONFATAL, "non-constant value given to `%%rep'");
return DIRECTIVE_FOUND;
}
- count = reloc_value(evalresult) + 1;
+ count = reloc_value(evalresult);
+ if (count >= REP_LIMIT) {
+ error(ERR_NONFATAL, "`%%rep' evalue exceeds limit");
+ count = 0;
+ } else
+ count++;
} else {
error(ERR_NONFATAL, "`%%rep' expects a repeat count");
count = 0;