[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, feature/bwk-csv, updated. gawk-4.1.0-4897-g2571e2d5
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, feature/bwk-csv, updated. gawk-4.1.0-4897-g2571e2d5 |
Date: |
Tue, 30 Aug 2022 14:02:22 -0400 (EDT) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, feature/bwk-csv has been updated
via 2571e2d55f4871bad41e4237e47442631cb2ebe0 (commit)
from 1ee8627c7bb42dad235c66e62050bf61f59cbb6e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=2571e2d55f4871bad41e4237e47442631cb2ebe0
commit 2571e2d55f4871bad41e4237e47442631cb2ebe0
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Tue Aug 30 21:01:55 2022 +0300
Grow field buffer for CSV parsing.
diff --git a/ChangeLog b/ChangeLog
index 9090eaca..6cd26809 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-08-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * field.c (comma_parse_field): Add resizing of new field buffer;
+ No Arbitrary Limits!
+
2022-08-29 Arnold D. Robbins <arnold@skeeve.com>
* field.c (comma_parse_field, set_comma_field): New functions.
diff --git a/field.c b/field.c
index 755a3fd4..be9f1fb0 100644
--- a/field.c
+++ b/field.c
@@ -813,6 +813,15 @@ comma_parse_field(long up_to, /* parse only up to
this field number */
while (*scan != comma && scan < end) {
if (*scan == '"') {
for (scan++; scan < end;) {
+ // grow buffer if needed
+ if (new_end >= newfield + buflen) {
+ size_t offset = buflen;
+
+ buflen *= 2;
+ erealloc(newfield, char *,
buflen, "comma_parse_field");
+ new_end = newfield + offset;
+ }
+
if (*scan == '"' && scan[1] == '"') {
// "" -> "
*new_end++ = '"';
scan += 2;
@@ -821,7 +830,6 @@ comma_parse_field(long up_to, /* parse only up to
this field number */
scan++;
break;
} else {
- // grow buffer if needed
*new_end++ = *scan++;
}
}
@@ -829,6 +837,13 @@ comma_parse_field(long up_to, /* parse only up to
this field number */
// unquoted field
while (*scan != comma && scan < end) {
// grow buffer if needed
+ if (new_end >= newfield + buflen) {
+ size_t offset = buflen;
+
+ buflen *= 2;
+ erealloc(newfield, char *,
buflen, "comma_parse_field");
+ new_end = newfield + offset;
+ }
*new_end++ = *scan++;
}
}
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++++
field.c | 17 ++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, feature/bwk-csv, updated. gawk-4.1.0-4897-g2571e2d5,
Arnold Robbins <=