diff --git a/ChangeLog b/ChangeLog index cb0762c..a026ec2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -83,6 +83,8 @@ and last consulted characters. if the end of the subject was encountered in a lookahead (conditional or otherwise), an atomic group, or a recursion. +16. Give error if pcre2test -t, -T, -tm or -TM is given an argument of zero. + Version 10.33 16-April-2019 --------------------------- diff --git a/src/pcre2test.c b/src/pcre2test.c index 455a3d6..838506b 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -3269,6 +3269,11 @@ return 0; +/* This function is no longer used. Keep it around for a while, just in case it +needs to be re-instated. */ + +#ifdef NEVERNEVERNEVER + /************************************************* * Move back by so many characters * *************************************************/ @@ -3313,6 +3318,7 @@ else /* 16-bit mode */ return pp - (PCRE2_SPTR16)subject; } } +#endif /* NEVERNEVERNEVER */ @@ -8652,6 +8658,11 @@ while (argc > 1 && argv[op][0] == '-' && argv[op][1] != 0) showtotaltimes = arg[1] == 'T'; if (argc > 2 && (uli = strtoul(argv[op+1], &endptr, 10), *endptr == 0)) { + if (uli == 0) + { + fprintf(stderr, "** Argument for %s must not be zero\n", arg); + exit(1); + } if (U32OVERFLOW(uli)) { fprintf(stderr, "** Argument for %s is too big\n", arg);