aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2022-09-14 00:30:25 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-09-14 00:30:25 +0000
commit95471615c83e3b3a09002496983ab86744b184cc (patch)
treecb2381cfb8f6edbc0e08b9214d3e79403aba770b
parent624aafd26c4e4d56e40ab160e7a02cad870d24e3 (diff)
parent5ccd4c5b18a6416fe6c9e7fdf21cd47b49e36536 (diff)
downloadone-true-awk-95471615c83e3b3a09002496983ab86744b184cc.tar.gz
Upgrade one-true-awk to 9e248c317b88470fc86aa7c988919dc49452c88c am: fbf461f5d4 am: 05af1187ef am: 4f2c842ed4 am: 5ccd4c5b18
Original change: https://android-review.googlesource.com/c/platform/external/one-true-awk/+/2215702 Change-Id: I24f2e91fc348e7234b4669924cad1eb7a3de7a11 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--FIXES5
-rw-r--r--METADATA6
-rw-r--r--main.c2
-rw-r--r--run.c5
-rw-r--r--tran.c3
5 files changed, 13 insertions, 8 deletions
diff --git a/FIXES b/FIXES
index ec76a4e..fdf782e 100644
--- a/FIXES
+++ b/FIXES
@@ -25,6 +25,11 @@ THIS SOFTWARE.
This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August 1987.
+Sep 12, 2022:
+ adjbuf minlen error (cannot be 0) in cat, resulting in NULL pbuf.
+ discovered by todd miller. also use-after-free issue with
+ tempfree in cat, thanks to Miguel Pineiro Jr and valgrind.
+
Aug 30, 2022:
Various leaks and use-after-free issues plugged/fixed.
Thanks to Miguel Pineiro Jr. <mpj@pineiro.cc>.
diff --git a/METADATA b/METADATA
index 69aefd3..fc82b16 100644
--- a/METADATA
+++ b/METADATA
@@ -5,11 +5,11 @@ third_party {
type: GIT
value: "https://github.com/onetrueawk/awk.git"
}
- version: "30791e0f686010b39c1ab2121df85da180960d53"
+ version: "9e248c317b88470fc86aa7c988919dc49452c88c"
license_type: NOTICE
last_upgrade_date {
year: 2022
- month: 8
- day: 31
+ month: 9
+ day: 12
}
}
diff --git a/main.c b/main.c
index 7b5af9e..f0b8608 100644
--- a/main.c
+++ b/main.c
@@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
-const char *version = "version 20220830";
+const char *version = "version 20220912";
#define DEBUG
#include <stdio.h>
diff --git a/run.c b/run.c
index d753e42..483b9d9 100644
--- a/run.c
+++ b/run.c
@@ -1197,16 +1197,17 @@ Cell *cat(Node **a, int q) /* a[0] cat a[1] */
x = execute(a[0]);
n1 = strlen(getsval(x));
- adjbuf(&s, &ssz, n1, recsize, 0, "cat1");
+ adjbuf(&s, &ssz, n1 + 1, recsize, 0, "cat1");
memcpy(s, x->sval, n1);
+ tempfree(x);
+
y = execute(a[1]);
n2 = strlen(getsval(y));
adjbuf(&s, &ssz, n1 + n2 + 1, recsize, 0, "cat2");
memcpy(s + n1, y->sval, n2);
s[n1 + n2] = '\0';
- tempfree(x);
tempfree(y);
z = gettemp();
diff --git a/tran.c b/tran.c
index c396db4..e1496cd 100644
--- a/tran.c
+++ b/tran.c
@@ -563,7 +563,6 @@ Cell *catstr(Cell *a, Cell *b) /* concatenate a and b */
char *qstring(const char *is, int delim) /* collect string up to next delim */
{
- const char *os = is;
int c, n;
const uschar *s = (const uschar *) is;
uschar *buf, *bp;
@@ -572,7 +571,7 @@ char *qstring(const char *is, int delim) /* collect string up to next delim */
FATAL( "out of space in qstring(%s)", s);
for (bp = buf; (c = *s) != delim; s++) {
if (c == '\n')
- SYNTAX( "newline in string %.20s...", os );
+ SYNTAX( "newline in string %.20s...", is );
else if (c != '\\')
*bp++ = c;
else { /* \something */