From df155e811072a8633a756a3bbbef1ce3d7ec72c5 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Mon, 16 May 2022 22:40:12 -0700 Subject: [PATCH] Escape escape characters in regular expression strings The %s here is a format specifier for WRITE_TO(), and the %c's are regular expression character classes. The %c's must be double-escaped so that the formatter doesn't choke due to there being too few variable arguments. This prevents a crash in inblorb when releasing along with a solution. --- inblorb/Chapter 3/Solution Deviser.w | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inblorb/Chapter 3/Solution Deviser.w b/inblorb/Chapter 3/Solution Deviser.w index 78914a298..cfa67a879 100755 --- a/inblorb/Chapter 3/Solution Deviser.w +++ b/inblorb/Chapter 3/Solution Deviser.w @@ -167,7 +167,7 @@ void Solution::read_skein_line(text_stream *line, int pass) { = void Solution::find_node_ID_in_tag(OUTPUT_STREAM, text_stream *line, char *tag) { TEMPORARY_TEXT(prototype) - WRITE_TO(prototype, "%c*?<%s nodeId=\"(%c*?)\"%c*", tag); + WRITE_TO(prototype, "%%c*?<%s nodeId=\"(%%c*?)\"%%c*", tag); wchar_t prototype_Cs[128]; Str::copy_to_wide_string(prototype_Cs, prototype, 128); match_results mr = Regexp::create_mr(); @@ -182,7 +182,7 @@ void Solution::find_node_ID_in_tag(OUTPUT_STREAM, text_stream *line, char *tag) = int Solution::find_text_of_tag(OUTPUT_STREAM, text_stream *line, char *tag) { TEMPORARY_TEXT(prototype) - WRITE_TO(prototype, "%c*?>(%c*?)(%%c*?)