-
Notifications
You must be signed in to change notification settings - Fork 681
[AutoPR- Security] Patch gawk for CVE-2026-40553, CVE-2026-40468, CVE-2026-40467 [MEDIUM] #18022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
azurelinux-security
wants to merge
2
commits into
microsoft:3.0-dev
Choose a base branch
from
azurelinux-security:azure-autosec/gawk/3.0/1160392
base: 3.0-dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| From 9200a51da72344ef2a24d367015a5cfcfec15ad4 Mon Sep 17 00:00:00 2001 | ||
| From: AllSpark <allspark@microsoft.com> | ||
| Date: Wed, 15 Jul 2026 11:30:59 +0000 | ||
| Subject: [PATCH] Small memory management fix in io.c. | ||
|
|
||
| Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> | ||
| Upstream-reference: AI Backport of https://cgit.git.savannah.gnu.org/cgit/gawk.git/patch/?id=a2d18c74109e41bec29a23098eba2e00057286d8 | ||
| --- | ||
| ChangeLog | 6 ++++++ | ||
| io.c | 5 ++++- | ||
| 2 files changed, 10 insertions(+), 1 deletion(-) | ||
|
|
||
| diff --git a/ChangeLog b/ChangeLog | ||
| index ff8b13c..acacd31 100644 | ||
| --- a/ChangeLog | ||
| +++ b/ChangeLog | ||
| @@ -1,3 +1,9 @@ | ||
| +2026-04-03 Arnold D. Robbins <arnold@skeeve.com> | ||
| + | ||
| + * io.c (do_getline_redir): Don't DEREF redir_exp too early. | ||
| + Thanks to Michał Majchrowicz <mmajchrowicz@afine.com> | ||
| + for the report. | ||
| + | ||
| 2023-05-07 Arnold D. Robbins <arnold@skeeve.com> | ||
|
|
||
| * 5.2.2: Release tar ball made. | ||
| diff --git a/io.c b/io.c | ||
| index 5eda8f9..b915d11 100644 | ||
| --- a/io.c | ||
| +++ b/io.c | ||
| @@ -2821,22 +2821,25 @@ do_getline_redir(int into_variable, enum redirval redirtype) | ||
| assert(redirtype != redirect_none); | ||
| redir_exp = TOP(); | ||
| rp = redirect(redir_exp, redirtype, & redir_error, false); | ||
| - DEREF(redir_exp); | ||
| decr_sp(); | ||
| if (rp == NULL) { | ||
| if (redir_error) { /* failed redirect */ | ||
| if (! do_traditional) | ||
| update_ERRNO_int(redir_error); | ||
| } | ||
| + DEREF(redir_exp); | ||
| return make_number((AWKNUM) -1.0); | ||
| } else if ((rp->flag & RED_TWOWAY) != 0 && rp->iop == NULL) { | ||
| if (is_non_fatal_redirect(redir_exp->stptr, redir_exp->stlen)) { | ||
| update_ERRNO_int(EBADF); | ||
| + DEREF(redir_exp); | ||
| return make_number((AWKNUM) -1.0); | ||
| } | ||
| (void) close_rp(rp, CLOSE_ALL); | ||
| + DEREF(redir_exp); // we're about to die, but what the heck, release it anyway | ||
| fatal(_("getline: attempt to read from closed read end of two-way pipe")); | ||
| } | ||
| + DEREF(redir_exp); | ||
| iop = rp->iop; | ||
| if (iop == NULL) /* end of input */ | ||
| return make_number((AWKNUM) 0.0); | ||
| -- | ||
| 2.45.4 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| From df552a38ae544bd61d79761919a090289bf9b3de Mon Sep 17 00:00:00 2001 | ||
| From: AllSpark <allspark@microsoft.com> | ||
| Date: Wed, 15 Jul 2026 11:30:45 +0000 | ||
| Subject: [PATCH] Minor integer overflow fixes. | ||
|
|
||
| Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> | ||
| Upstream-reference: AI Backport of https://cgit.git.savannah.gnu.org/cgit/gawk.git/patch/?id=062f2f2581b991362c046f7f2e238ffa34e6f8c7 | ||
| --- | ||
| ChangeLog | 8 ++++++++ | ||
| builtin.c | 2 +- | ||
| node.c | 2 +- | ||
| 3 files changed, 10 insertions(+), 2 deletions(-) | ||
|
|
||
| diff --git a/ChangeLog b/ChangeLog | ||
| index acacd31..f814e25 100644 | ||
| --- a/ChangeLog | ||
| +++ b/ChangeLog | ||
| @@ -1,3 +1,11 @@ | ||
| +2026-04-04 Arnold D. Robbins <arnold@skeeve.com> | ||
| + | ||
| + * builtin.c (do_sub): Make `sofar' be size_t to avoid | ||
| + integer overflows. Thanks to Michał Majchrowicz | ||
| + <mmajchrowicz@afine.com> for the report. | ||
| + * node.c (parse_escape): Change `i' to int64_t to avoid | ||
| + overflows. Thanks to ASan with gcc -m32. | ||
| + | ||
| 2026-04-03 Arnold D. Robbins <arnold@skeeve.com> | ||
|
|
||
| * io.c (do_getline_redir): Don't DEREF redir_exp too early. | ||
| diff --git a/builtin.c b/builtin.c | ||
| index 0e60922..bba7346 100644 | ||
| --- a/builtin.c | ||
| +++ b/builtin.c | ||
| @@ -2983,7 +2983,7 @@ do_sub(int nargs, unsigned int flags) | ||
| char *repl; | ||
| char *replend; | ||
| size_t repllen; | ||
| - int sofar; | ||
| + size_t sofar; | ||
| int ampersands; | ||
| int matches = 0; | ||
| Regexp *rp; | ||
| diff --git a/node.c b/node.c | ||
| index 6c9a730..cca9701 100644 | ||
| --- a/node.c | ||
| +++ b/node.c | ||
| @@ -547,7 +547,7 @@ parse_escape(const char **string_ptr) | ||
| parse_escape(const char **string_ptr) | ||
| { | ||
| int c = *(*string_ptr)++; | ||
| - int i; | ||
| + int64_t i; | ||
| int count; | ||
| int j; | ||
| const char *start; | ||
| -- | ||
| 2.45.4 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| From 6fc71baa7f4f2a6bb75327fbc6b8112adecf04c5 Mon Sep 17 00:00:00 2001 | ||
| From: AllSpark <allspark@microsoft.com> | ||
| Date: Wed, 15 Jul 2026 11:31:16 +0000 | ||
| Subject: [PATCH] Avoid buffer overflow in extension/readdir.c. | ||
|
|
||
| Signed-off-by: Azure Linux Security Servicing Account <azurelinux-security@microsoft.com> | ||
| Upstream-reference: AI Backport of https://cgit.git.savannah.gnu.org/cgit/gawk.git/patch/?id=cca0366144336b49aaa7d5d949966ce8e2c70843 | ||
| --- | ||
| extension/ChangeLog | 6 ++++++ | ||
| extension/readdir.c | 8 +++++--- | ||
| 2 files changed, 11 insertions(+), 3 deletions(-) | ||
|
|
||
| diff --git a/extension/ChangeLog b/extension/ChangeLog | ||
| index 3f80a79..360ff82 100644 | ||
| --- a/extension/ChangeLog | ||
| +++ b/extension/ChangeLog | ||
| @@ -1,3 +1,9 @@ | ||
| +2026-04-15 Arnold D. Robbins <arnold@skeeve.com> | ||
| + | ||
| + * readdir.c (ftype): Use snprintf() to check for buffer | ||
| + overflow in the file name before calling stat(). Thanks to | ||
| + Marcin Wyczechowski <mwyczechowski@afine.com> for the report. | ||
| + | ||
| 2023-05-07 Arnold D. Robbins <arnold@skeeve.com> | ||
|
|
||
|
|
||
| diff --git a/extension/readdir.c b/extension/readdir.c | ||
| index e367ff1..2d169e8 100644 | ||
| --- a/extension/readdir.c | ||
| +++ b/extension/readdir.c | ||
| @@ -110,10 +110,12 @@ ftype(struct dirent *entry, const char *dirname) | ||
| #endif | ||
| char fname[PATH_MAX]; | ||
| struct stat sbuf; | ||
| + int count; | ||
|
|
||
| - strcpy(fname, dirname); | ||
| - strcat(fname, "/"); | ||
| - strcat(fname, entry->d_name); | ||
| + count = snprintf(fname, sizeof(fname), "%s/%s", dirname, entry->d_name); | ||
| + if (count > sizeof(fname)) | ||
| + return "u"; // buffer overflow. skip stat() call. | ||
| + | ||
| if (stat(fname, &sbuf) == 0) { | ||
| if (S_ISBLK(sbuf.st_mode)) | ||
| return "b"; | ||
| -- | ||
| 2.45.4 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skipping is the only solution to test failures because of chroot restrictions