Displaying 8 results from an estimated 8 matches for "badsub".
Did you mean:
addsub
2019 Jan 25
0
[klibc:update-dash] [PARSER] Catch variable length expansions on non-existant specials
...ame:
STPUTC(c, out);
c = pgetc_eatbnl();
} while (is_digit(c));
- }
- else if (is_special(c)) {
+ } else {
int cc = c;
c = pgetc_eatbnl();
@@ -1251,10 +1250,14 @@ varname:
}
}
+ if (!is_special(cc)) {
+ if (subtype == VSLENGTH)
+ subtype = 0;
+ goto badsub;
+ }
+
USTPUTC(cc, out);
}
- else
- goto badsub;
if (subtype == 0) {
switch (c) {
2020 Mar 28
0
[klibc:update-dash] dash: [PARSER] Catch variable length expansions on non-existant specials
...ame:
STPUTC(c, out);
c = pgetc_eatbnl();
} while (is_digit(c));
- }
- else if (is_special(c)) {
+ } else {
int cc = c;
c = pgetc_eatbnl();
@@ -1251,10 +1250,14 @@ varname:
}
}
+ if (!is_special(cc)) {
+ if (subtype == VSLENGTH)
+ subtype = 0;
+ goto badsub;
+ }
+
USTPUTC(cc, out);
}
- else
- goto badsub;
if (subtype == 0) {
switch (c) {
2019 Jan 25
0
[klibc:update-dash] parser: Fix parsing of ${}
...++ b/usr/dash/parser.c
@@ -1262,7 +1262,7 @@ varname:
STPUTC(c, out);
c = pgetc_eatbnl();
} while (is_digit(c));
- } else {
+ } else if (c != '}') {
int cc = c;
c = pgetc_eatbnl();
@@ -1290,7 +1290,8 @@ varname:
}
USTPUTC(cc, out);
- }
+ } else
+ goto badsub;
if (subtype == 0) {
int cc = c;
2019 Jan 25
0
[klibc:update-dash] parser: Fix parameter expansion inside inner double quotes
...Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
usr/dash/parser.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index efa8060f..8e407816 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -1325,10 +1325,11 @@ badsub:
pungetc();
}
- if (newsyn == ARISYNTAX && subtype > VSNORMAL)
+ if (newsyn == ARISYNTAX)
newsyn = DQSYNTAX;
- if (newsyn != synstack->syntax) {
+ if ((newsyn != synstack->syntax || synstack->innerdq) &&
+ subtype != VSNORMAL) {
synstack_push(...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix parsing of ${}
...++ b/usr/dash/parser.c
@@ -1262,7 +1262,7 @@ varname:
STPUTC(c, out);
c = pgetc_eatbnl();
} while (is_digit(c));
- } else {
+ } else if (c != '}') {
int cc = c;
c = pgetc_eatbnl();
@@ -1290,7 +1290,8 @@ varname:
}
USTPUTC(cc, out);
- }
+ } else
+ goto badsub;
if (subtype == 0) {
int cc = c;
2020 Mar 28
0
[klibc:update-dash] dash: parser: Fix parameter expansion inside inner double quotes
...Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
usr/dash/parser.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/usr/dash/parser.c b/usr/dash/parser.c
index efa8060f..8e407816 100644
--- a/usr/dash/parser.c
+++ b/usr/dash/parser.c
@@ -1325,10 +1325,11 @@ badsub:
pungetc();
}
- if (newsyn == ARISYNTAX && subtype > VSNORMAL)
+ if (newsyn == ARISYNTAX)
newsyn = DQSYNTAX;
- if (newsyn != synstack->syntax) {
+ if ((newsyn != synstack->syntax || synstack->innerdq) &&
+ subtype != VSNORMAL) {
synstack_push(...
2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...if (c == cc)
- subtype++;
- else
- pungetc();
- break;
- }
+ subtype = c == '#' ? VSTRIMLEFT :
+ VSTRIMRIGHT;
+ c = pgetc_eatbnl();
+ if (c == cc)
+ subtype++;
+ else
+ pungetc();
+
+ newsyn = BASESYNTAX;
+ break;
}
} else {
badsub:
pungetc();
}
+
+ if (newsyn == ARISYNTAX && subtype > VSNORMAL)
+ newsyn = DQSYNTAX;
+
+ if (newsyn != synstack->syntax) {
+ synstack_push(&synstack,
+ synstack->prev ?:
+ alloca(sizeof(*synstack)),
+ newsyn);
+
+ synstack->varpushe...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...if (c == cc)
- subtype++;
- else
- pungetc();
- break;
- }
+ subtype = c == '#' ? VSTRIMLEFT :
+ VSTRIMRIGHT;
+ c = pgetc_eatbnl();
+ if (c == cc)
+ subtype++;
+ else
+ pungetc();
+
+ newsyn = BASESYNTAX;
+ break;
}
} else {
badsub:
pungetc();
}
+
+ if (newsyn == ARISYNTAX && subtype > VSNORMAL)
+ newsyn = DQSYNTAX;
+
+ if (newsyn != synstack->syntax) {
+ synstack_push(&synstack,
+ synstack->prev ?:
+ alloca(sizeof(*synstack)),
+ newsyn);
+
+ synstack->varpushe...