===================================================================
@@ -29,7 +29,9 @@ along with GCC; see the file COPYING3.
#include "hashtab.h"
#include "hash-table.h"
#include "vec.h"
+#include <stdlib.h>
+const unsigned capture_max = 4;
/* libccp helpers. */
@@ -816,7 +818,11 @@ static struct operand *
parse_capture (cpp_reader *r, operand *op)
{
eat_token (r, CPP_ATSIGN);
- return new capture (get_number (r), op);
+ const cpp_token *token = peek (r);
+ const char *num = get_number (r);
+ if (atoi (num) >= capture_max)
+ fatal_at (token, "capture cannot be greater than %u", capture_max - 1);
+ return new capture (num, op);
}
/* Parse