diff --git a/ChangeLog b/ChangeLog index f76a20d..9bf5bab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -54,6 +54,10 @@ not recognize this syntax. 7. Automatic callouts are no longer generated before and after callouts in the pattern. +8. When pcre2test was outputing information from a callout, the caret indicator +for the current position in the subject line was incorrect if it was after an +escape sequence for a character whose code point was greater than \x{ff}. + Version 10.22 29-July-2016 -------------------------- diff --git a/src/pcre2test.c b/src/pcre2test.c index 4fa0ecd..039a4f0 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -2528,6 +2528,8 @@ static int pchar(uint32_t c, BOOL utf, FILE *f) { int n = 0; +char tempbuffer[16]; + if (PRINTOK(c)) { if (f != NULL) fprintf(f, "%c", c); @@ -2549,6 +2551,8 @@ if (c < 0x100) } if (f != NULL) n = fprintf(f, "\\x{%02x}", c); + else n = sprintf(tempbuffer, "\\x{%02x}", c); + return n >= 0 ? n : 0; } @@ -5070,7 +5074,7 @@ during matching. */ #ifdef SUPPORT_PCRE2_8 if (test_mode == PCRE8_MODE) { - VALGRIND_MAKE_MEM_UNDEFINED(pbuffer8 + valgrind_access_length, + VALGRIND_MAKE_MEM_UNDEFINED(pbuffer8 + valgrind_access_length, pbuffer8_size - valgrind_access_length); } #endif @@ -5360,10 +5364,10 @@ if (post_start > 0) for (i = 0; i < subject_length - pre_start - post_start + 4; i++) fprintf(outfile, " "); -if (cb->next_item_length != 0) +if (cb->next_item_length != 0) fprintf(outfile, "%.*s", (int)(cb->next_item_length), pbuffer8 + cb->pattern_position); - + fprintf(outfile, "\n"); first_callout = FALSE; @@ -7708,14 +7712,14 @@ while (notdone) skipping = FALSE; setlocale(LC_CTYPE, "C"); } - - /* Otherwise, if we are not skipping, and the line is not a data comment + + /* Otherwise, if we are not skipping, and the line is not a data comment line starting with "\=", process a data line. */ - + else if (!skipping && !(p[0] == '\\' && p[1] == '=' && isspace(p[2]))) - { + { rc = process_data(); - } + } } /* We do not have a pattern set up for testing. Lines starting with # are diff --git a/testdata/testinput5 b/testdata/testinput5 index 4a5dbb9..74fe6d5 100644 --- a/testdata/testinput5 +++ b/testdata/testinput5 @@ -1733,4 +1733,7 @@ /ab(?<=A\RB)/utf +/../utf,auto_callout + \n\x{123}\x{123}\x{123}\x{123} + # End of testinput5 diff --git a/testdata/testoutput5 b/testdata/testoutput5 index 4e95df3..9fb2ee7 100644 --- a/testdata/testoutput5 +++ b/testdata/testoutput5 @@ -4171,4 +4171,13 @@ Failed: error 125 at offset 1: lookbehind assertion is not fixed length /ab(?<=A\RB)/utf Failed: error 125 at offset 2: lookbehind assertion is not fixed length +/../utf,auto_callout + \n\x{123}\x{123}\x{123}\x{123} +--->\x{0a}\x{123}\x{123}\x{123}\x{123} + +0 ^ . + +0 ^ . + +1 ^ ^ . + +2 ^ ^ + 0: \x{123}\x{123} + # End of testinput5