Accepting request 968378 from home:Andreas_Schwab:Factory

- fortify-workaround.patch: work around false positive _FORTIFY_SOURCE=3
  failure

OBS-URL: https://build.opensuse.org/request/show/968378
OBS-URL: https://build.opensuse.org/package/show/Base:System/autogen?expand=0&rev=78
This commit is contained in:
Andreas Schwab 2022-04-11 08:10:24 +00:00 committed by Git OBS Bridge
parent 24f0ef4e0e
commit 4da28a2173
3 changed files with 127 additions and 2 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Apr 8 14:54:03 UTC 2022 - Andreas Schwab <schwab@suse.de>
- fortify-workaround.patch: work around false positive _FORTIFY_SOURCE=3
failure
-------------------------------------------------------------------
Wed Jun 10 11:53:58 UTC 2020 - Bernhard Wiedemann <bwiedemann@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package autogen
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -36,13 +36,14 @@ Patch4: sprintf-overflow.patch
Patch5: gcc9-fix-wrestrict.patch
# PATCH-FIX-UPSTREAM Allow building with guile 3.0
Patch6: guile-version.patch
Patch7: fortify-workaround.patch
BuildRequires: fdupes
BuildRequires: guile-devel
BuildRequires: makeinfo
BuildRequires: pkgconfig >= 0.9.0
BuildRequires: pkgconfig(libxml-2.0)
Requires(post): %{install_info_prereq}
Requires(preun): %{install_info_prereq}
Requires(preun):%{install_info_prereq}
%description
AutoGen is a tool designed for generating program files that contain
@ -92,6 +93,7 @@ well.
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
touch aclocal.m4 configure Makefile.in config-h.in
%build

117
fortify-workaround.patch Normal file
View File

@ -0,0 +1,117 @@
Index: autogen-5.18.16/agen5/defDirect.c
===================================================================
--- autogen-5.18.16.orig/agen5/defDirect.c
+++ autogen-5.18.16/agen5/defDirect.c
@@ -650,6 +650,7 @@ doDir_include(directive_enum_t id, char
{
static char const * const apzSfx[] = { DIRECT_INC_DEF_SFX, NULL };
scan_ctx_t * new_ctx;
+ char *data;
size_t inc_sz;
char full_name[ AG_PATH_MAX + 1 ];
(void)id;
@@ -684,9 +685,11 @@ doDir_include(directive_enum_t id, char
*/
{
size_t sz = sizeof(scan_ctx_t) + 4 + inc_sz;
- new_ctx = (scan_ctx_t *)AGALOC(sz, "inc def head");
+ data = AGALOC(sz, "inc def head");
- memset(VOIDP(new_ctx), 0, sz);
+ memset(data, 0, sz);
+ new_ctx = (scan_ctx_t *)data;
+ data += sizeof(scan_ctx_t);
new_ctx->scx_line = 1;
}
@@ -700,7 +703,7 @@ doDir_include(directive_enum_t id, char
new_ctx->scx_scan =
new_ctx->scx_data =
- scan_next = (char *)(new_ctx + 1);
+ scan_next = data;
/*
* Read all the data. Usually in a single read, but loop
@@ -829,6 +832,7 @@ doDir_shell(directive_enum_t id, char co
static size_t const endshell_len = sizeof("\n#endshell") - 1;
scan_ctx_t * pCtx;
+ char *data;
char * pzText = scan_next;
(void)arg;
@@ -888,8 +892,10 @@ doDir_shell(directive_enum_t id, char co
* This is an extra allocation and copy, but easier than rewriting
* 'loadData()' for this special context.
*/
- pCtx = (scan_ctx_t *)AGALOC(sizeof(scan_ctx_t) + strlen(pzText) + 4,
- "shell output");
+ data = AGALOC(sizeof(scan_ctx_t) + strlen(pzText) + 4,
+ "shell output");
+ pCtx = (scan_ctx_t *)data;
+ data += sizeof(scan_ctx_t);
/*
* Link the new scan data into the context stack
@@ -902,7 +908,7 @@ doDir_shell(directive_enum_t id, char co
*/
AGDUPSTR(pCtx->scx_fname, DIRECT_SHELL_COMP_DEFS, DIRECT_SHELL_COMP_DEFS);
pCtx->scx_scan =
- pCtx->scx_data = (char *)(pCtx + 1);
+ pCtx->scx_data = data;
pCtx->scx_line = 0;
strcpy(pCtx->scx_scan, pzText);
AGFREE(pzText);
Index: autogen-5.18.16/agen5/defLoad.c
===================================================================
--- autogen-5.18.16.orig/agen5/defLoad.c
+++ autogen-5.18.16/agen5/defLoad.c
@@ -455,7 +455,9 @@ read_defs(void)
* Allocate the space we need for our definitions.
*/
rem_sz = data_sz+4+sizeof(*base_ctx);
- base_ctx = (scan_ctx_t *)AGALOC(rem_sz, "file buf");
+ data = AGALOC(rem_sz, "file buf");
+ base_ctx = (scan_ctx_t *)data;
+ data += sizeof (*base_ctx);
memset(VOIDP(base_ctx), 0, rem_sz);
base_ctx->scx_line = 1;
rem_sz = data_sz;
@@ -466,9 +468,8 @@ read_defs(void)
* is never deallocated, we do not have to remember the initial
* value. (It may get reallocated here in this routine, tho...)
*/
- data =
base_ctx->scx_scan =
- base_ctx->scx_data = (char *)(base_ctx + 1);
+ base_ctx->scx_data = data;
base_ctx->scx_next = NULL;
/*
@@ -531,18 +532,20 @@ read_defs(void)
*/
data_sz += (rem_sz = 0x1000);
dataOff = data - base_ctx->scx_data;
- p = AGREALOC(VOIDP(base_ctx), data_sz + 4 + sizeof(*base_ctx),
- "expand f buf");
+ data = AGREALOC(VOIDP(base_ctx), data_sz + 4 + sizeof(*base_ctx),
+ "expand f buf");
+ p = (scan_ctx_t *)data;
+ data += sizeof(*p);
/*
* The buffer may have moved. Set the data pointer at an
* offset within the new buffer and make sure our base pointer
* has been corrected as well.
*/
- if (p != base_ctx) {
+ {
p->scx_scan = \
- p->scx_data = (char *)(p + 1);
- data = p->scx_data + dataOff;
+ p->scx_data = data;
+ data += dataOff;
base_ctx = p;
}
}