gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, master, updated. gawk-4.1.0-4735-g45a9aeb1


From: Arnold Robbins
Subject: [SCM] gawk branch, master, updated. gawk-4.1.0-4735-g45a9aeb1
Date: Thu, 2 Jun 2022 15:05:39 -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  45a9aeb1808567fa032ab8cb977fb8a48d8fb886 (commit)
      from  0f12de2956197c2b889bf780e44b2724381f4317 (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=45a9aeb1808567fa032ab8cb977fb8a48d8fb886

commit 45a9aeb1808567fa032ab8cb977fb8a48d8fb886
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Thu Jun 2 22:05:13 2022 +0300

    Fix a memory issue in do_sub.

diff --git a/ChangeLog b/ChangeLog
index 33eb45b1..0ff01ddb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-06-02         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * builtin.c (do_sub): Fix memory corruption when substituting
+       into a value that is a typed regex. Thanks to valgrind
+       for the report.
+
 2022-05-24         Adam Van Scyoc        <avanscy@g.clemson.edu>
 
        * awkgram.y (make_assignable): Handle Op_field_assign.
diff --git a/builtin.c b/builtin.c
index 0afeb944..3a38a478 100644
--- a/builtin.c
+++ b/builtin.c
@@ -3325,11 +3325,13 @@ done:
                if ((target->flags & REGEX) != 0) {
                        is_regex = true;
 
-                       // free old regex registers
-                       refree(target->typed_re->re_reg[0]);
-                       if (target->typed_re->re_reg[1] != NULL)
-                               refree(target->typed_re->re_reg[1]);
-                       freenode(target->typed_re);
+                       if (target->valref == 1) {
+                               // free old regex registers
+                               refree(target->typed_re->re_reg[0]);
+                               if (target->typed_re->re_reg[1] != NULL)
+                                       refree(target->typed_re->re_reg[1]);
+                               freenode(target->typed_re);
+                       }
                }
                unref(*lhs);            // nuke original value
                if (is_regex)

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

Summary of changes:
 ChangeLog |  6 ++++++
 builtin.c | 12 +++++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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