Package: re2c / 0.16-2

01_fix_segvault_with_null_input.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# fix for segvault with null input, backported from upstream commit 54711f6
#
# bug details:
# debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=823999
# upstream: https://github.com/skvadrik/re2c/issues/142
--- a/bootstrap/src/parse/lex.cc
+++ b/bootstrap/src/parse/lex.cc
@@ -118,14 +118,14 @@
 	++YYCURSOR;
 #line 202 "../src/parse/lex.re"
 	{
-					if (!ignore_eoc && opts->target == opt_t::CODE)
-					{
-						out.wraw(tok, tok_len () - 1);
-						// -1 so we don't write out the \0
-					}
-					if(cur == eof)
-					{
+					if(cur == eof) {
+						if (!ignore_eoc && opts->target == opt_t::CODE) {
+							out.wraw(tok, tok_len () - 1);
+							// -1 so we don't write out the \0
+						}
 						return Stop;
+					} else {
+						goto echo;
 					}
 				}
 #line 132 "src/parse/lex.cc"
--- a/src/parse/lex.re
+++ b/src/parse/lex.re
@@ -200,14 +200,14 @@
 					goto echo;
 				}
 	zero		{
-					if (!ignore_eoc && opts->target == opt_t::CODE)
-					{
-						out.wraw(tok, tok_len () - 1);
-						// -1 so we don't write out the \0
-					}
-					if(cur == eof)
-					{
+					if(cur == eof) {
+						if (!ignore_eoc && opts->target == opt_t::CODE) {
+							out.wraw(tok, tok_len () - 1);
+							// -1 so we don't write out the \0
+						}
 						return Stop;
+					} else {
+						goto echo;
 					}
 				}
 	*			{