gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2544-g9fff07


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2544-g9fff07d
Date: Wed, 12 Apr 2017 16:29:20 -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, master has been updated
       via  9fff07da8c25183f53934c0155d1fa49bc97198e (commit)
       via  92f4d54776e4183a81209a9ce3a28f052f9249e4 (commit)
      from  ec0c2d411eac8362f18572b2d8bd8617368b3ca6 (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=9fff07da8c25183f53934c0155d1fa49bc97198e

commit 9fff07da8c25183f53934c0155d1fa49bc97198e
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Apr 12 23:28:55 2017 +0300

    Fix a memory leak in mpfr formatting values.

diff --git a/ChangeLog b/ChangeLog
index 882f7f4..6e053f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-04-12         Arnold D. Robbins     <address@hidden>
+
+       * mpfr.c (mpg_format_val): Set STRCUR flag when we're done.
+       Fixes a memory leak. Thanks to valgrind for the report.
+
 2017-04-12         Manuel Collado        <address@hidden>
 
        Fix the FPAT bug reported by Ed Morton in the gawk-bug mailing list.
diff --git a/mpfr.c b/mpfr.c
index ec8d556..5a2a35d 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -384,6 +384,7 @@ mpg_format_val(const char *format, int index, NODE *s)
        if ((s->flags & (MALLOC|STRCUR)) == (MALLOC|STRCUR))
                efree(s->stptr);
        s->stptr = r->stptr;
+       s->flags |= STRCUR;
        freenode(r);    /* Do not unref(r)! We want to keep s->stptr == 
r->stpr.  */
        free_wstr(s);
        return s;

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=92f4d54776e4183a81209a9ce3a28f052f9249e4

commit 92f4d54776e4183a81209a9ce3a28f052f9249e4
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Apr 12 23:25:51 2017 +0300

    Fix valgrind invalid read issues in new fpat parsing.

diff --git a/ChangeLog b/ChangeLog
index fd75980..882f7f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
        * field.c (fpat_parse_field): Restructure the code to reduce complexity
        and document the new structure.
 
+       * field.c (fpat_parse_field): Further restructuring to avoid
+       invalid reads as reported by valgrind.
+
 2017-04-10         Andrew J. Schorr     <address@hidden>
 
        * awk.h (enum opcodeval): For the avoidance of doubt, specify that
diff --git a/field.c b/field.c
index 8145141..608be7d 100644
--- a/field.c
+++ b/field.c
@@ -1581,7 +1581,7 @@ fpat_parse_field(long up_to,      /* parse only up to 
this field number */
        int regex_flags = RE_NEED_START;
        mbstate_t mbs;
        char* field_start;
-       bool field_found;
+       bool field_found = false;
 
        memset(&mbs, 0, sizeof(mbstate_t));
 
@@ -1594,7 +1594,7 @@ fpat_parse_field(long up_to,      /* parse only up to 
this field number */
        if (rp == NULL) /* use FPAT */
                rp = FPAT_regexp;
 
-       while (scan <= end && nf < up_to) {  /* still something to parse */
+       while (scan < end && nf < up_to) {  /* still something to parse */
 
                /* first attempt to match the next field */
                start = scan;
@@ -1632,10 +1632,17 @@ fpat_parse_field(long up_to,    /* parse only up to 
this field number */
                         */
                        if (sep_arr != NULL)
                                set_element(nf, start, (long) (end - start), 
sep_arr);
-                       scan = end + 1;
+                       scan = end;
                }
        }
 
+       /*
+        * If the last field extends up to the end of the record, generate
+        * a null trailing separator
+        */
+       if (sep_arr != NULL && scan == end && field_found) 
+               set_element(nf, scan, 0L, sep_arr);
+
        *buf = scan;
        return nf;
 }

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog |  8 ++++++++
 field.c   | 13 ++++++++++---
 mpfr.c    |  1 +
 3 files changed, 19 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]