gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-4988-ge596ff6c


From: Arnold Robbins
Subject: [SCM] gawk branch, gawk-5.2-stable, updated. gawk-4.1.0-4988-ge596ff6c
Date: Sun, 5 Feb 2023 10:57:47 -0500 (EST)

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, gawk-5.2-stable has been updated
       via  e596ff6cddf96e575cc0f16e3a791bb6b51fc425 (commit)
      from  a6e03b9f35b553903901f48d09908e41a7ea189d (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=e596ff6cddf96e575cc0f16e3a791bb6b51fc425

commit e596ff6cddf96e575cc0f16e3a791bb6b51fc425
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Sun Feb 5 17:57:26 2023 +0200

    Small fix for undefined behavior.

diff --git a/ChangeLog b/ChangeLog
index 99f96267..ff08342d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-02-05         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * io.c (do_getline_redir): If `s' from get_a_record is NULL,
+       pass "" to make_string() instead. Avoids undefined behavior
+       complaint from GCC -fsanitize=undefined. Thanks to Sam James
+       <sam@gentoo.org> for the report.
+       (do_getline): Ditto.
+
 2023-02-03         John E. Malmberg      <wb8tyw@qsl.net>
 
        * custom.h (bool) OpenVMS compilers may have a bool type
diff --git a/io.c b/io.c
index 1055443f..fd830c08 100644
--- a/io.c
+++ b/io.c
@@ -2868,7 +2868,9 @@ do_getline_redir(int into_variable, enum redirval 
redirtype)
                set_record(s, cnt, field_width);
        else {                  /* assignment to variable */
                unref(*lhs);
-               *lhs = make_string(s, cnt);
+               // s could be NULL if cnt == 0, avoid passing a null
+               // pointer to make_string().
+               *lhs = make_string(s != NULL ? s : "", cnt);
                (*lhs)->flags |= USER_INPUT;
        }
 
@@ -2912,7 +2914,9 @@ do_getline(int into_variable, IOBUF *iop)
                NODE **lhs;
                lhs = POP_ADDRESS();
                unref(*lhs);
-               *lhs = make_string(s, cnt);
+               // s could be NULL if cnt == 0, avoid passing a null
+               // pointer to make_string().
+               *lhs = make_string(s != NULL ? s : "", cnt);
                (*lhs)->flags |= USER_INPUT;
        }
        return make_number((AWKNUM) 1.0);

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

Summary of changes:
 ChangeLog | 8 ++++++++
 io.c      | 8 ++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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