import libXt-1.1.5-12.el8
This commit is contained in:
parent
6af708cfbd
commit
2a75139f1a
134
SOURCES/0001-no-need-to-check-XFree-arguments.patch
Normal file
134
SOURCES/0001-no-need-to-check-XFree-arguments.patch
Normal file
@ -0,0 +1,134 @@
|
||||
From 1d555838d03f191d5f21268868a4ea180c2b24f2 Mon Sep 17 00:00:00 2001
|
||||
From: Walter Harms <wharms@bfs.de>
|
||||
Date: Tue, 8 Jan 2019 21:25:00 +0100
|
||||
Subject: [PATCH 1/9] no need to check XFree arguments
|
||||
|
||||
---
|
||||
src/TMstate.c | 5 ++---
|
||||
src/VarCreate.c | 19 +++++++------------
|
||||
src/VarGet.c | 16 ++++------------
|
||||
3 files changed, 13 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/src/TMstate.c b/src/TMstate.c
|
||||
index 4a634b4..9763fc0 100644
|
||||
--- a/src/TMstate.c
|
||||
+++ b/src/TMstate.c
|
||||
@@ -742,8 +742,7 @@ static void FreeContext(
|
||||
context->numMatches = 0;
|
||||
else if (*contextPtr)
|
||||
{
|
||||
- if ((*contextPtr)->matches)
|
||||
- XtFree ((char *) ((*contextPtr)->matches));
|
||||
+ XtFree ((char *) ((*contextPtr)->matches));
|
||||
XtFree((char *)*contextPtr);
|
||||
}
|
||||
|
||||
@@ -2062,7 +2061,7 @@ static Boolean ComposeTranslations(
|
||||
dest->core.tm.proc_table =
|
||||
(XtActionProc *) MakeBindData(newBindings, numNewBindings, bindData);
|
||||
|
||||
- if (bindData) XtFree((char *)bindData);
|
||||
+ XtFree((char *)bindData);
|
||||
|
||||
dest->core.tm.translations = newTable;
|
||||
|
||||
diff --git a/src/VarCreate.c b/src/VarCreate.c
|
||||
index 0fba379..4f5058c 100644
|
||||
--- a/src/VarCreate.c
|
||||
+++ b/src/VarCreate.c
|
||||
@@ -79,9 +79,8 @@ _XtVaCreateWidget(
|
||||
widget = _XtCreateWidget(name, widget_class, parent, (ArgList)NULL,
|
||||
(Cardinal)0, typed_args, num_args);
|
||||
|
||||
- if (typed_args != NULL) {
|
||||
- XtFree((XtPointer)typed_args);
|
||||
- }
|
||||
+
|
||||
+ XtFree((XtPointer)typed_args);
|
||||
|
||||
return widget;
|
||||
}
|
||||
@@ -165,9 +164,8 @@ XtVaAppCreateShell(
|
||||
_XtVaToTypedArgList(var, total_count, &typed_args, &num_args);
|
||||
widget = _XtAppCreateShell((String)name, (String)class, widget_class,
|
||||
display, (ArgList)NULL, (Cardinal)0, typed_args, num_args);
|
||||
- if (typed_args != NULL) {
|
||||
- XtFree((XtPointer)typed_args);
|
||||
- }
|
||||
+
|
||||
+ XtFree((XtPointer)typed_args);
|
||||
|
||||
va_end(var);
|
||||
UNLOCK_APP(app);
|
||||
@@ -199,9 +197,8 @@ XtVaCreatePopupShell(
|
||||
_XtVaToTypedArgList(var, total_count, &typed_args, &num_args);
|
||||
widget = _XtCreatePopupShell((String)name, widget_class, parent,
|
||||
(ArgList)NULL, (Cardinal)0, typed_args, num_args);
|
||||
- if (typed_args != NULL) {
|
||||
- XtFree((XtPointer)typed_args);
|
||||
- }
|
||||
+
|
||||
+ XtFree((XtPointer)typed_args);
|
||||
|
||||
va_end(var);
|
||||
UNLOCK_APP(app);
|
||||
@@ -254,9 +251,7 @@ XtVaSetSubvalues(XtPointer base, XtResourceList resources, Cardinal num_resource
|
||||
|
||||
XtSetSubvalues(base, resources, num_resources, args, num_args);
|
||||
|
||||
- if (num_args != 0) {
|
||||
- XtFree((XtPointer)args);
|
||||
- }
|
||||
+ XtFree((XtPointer)args);
|
||||
|
||||
va_end(var);
|
||||
}
|
||||
diff --git a/src/VarGet.c b/src/VarGet.c
|
||||
index 7b4cea6..ccd4d10 100644
|
||||
--- a/src/VarGet.c
|
||||
+++ b/src/VarGet.c
|
||||
@@ -86,9 +86,7 @@ XtVaGetSubresources(
|
||||
_XtGetSubresources(widget, base, name, class, resources, num_resources,
|
||||
NULL, 0, args, num_args);
|
||||
|
||||
- if (num_args != 0) {
|
||||
- XtFree((XtPointer)args);
|
||||
- }
|
||||
+ XtFree((XtPointer)args);
|
||||
|
||||
va_end(var);
|
||||
UNLOCK_APP(app);
|
||||
@@ -116,9 +114,7 @@ XtVaGetApplicationResources(Widget widget, XtPointer base, XtResourceList resour
|
||||
_XtGetApplicationResources(widget, base, resources, num_resources,
|
||||
NULL, 0, args, num_args);
|
||||
|
||||
- if (num_args != 0) {
|
||||
- XtFree((XtPointer)args);
|
||||
- }
|
||||
+ XtFree((XtPointer)args);
|
||||
|
||||
va_end(var);
|
||||
UNLOCK_APP(app);
|
||||
@@ -273,9 +269,7 @@ XtVaGetValues(Widget widget, ...)
|
||||
}
|
||||
va_end(var);
|
||||
|
||||
- if (resources != (XtResourceList)NULL) {
|
||||
- XtFree((XtPointer)resources);
|
||||
- }
|
||||
+ XtFree((XtPointer)resources);
|
||||
|
||||
if (total_count != typed_count) {
|
||||
XtGetValues(widget, args, count);
|
||||
@@ -307,7 +301,5 @@ XtVaGetSubvalues(XtPointer base,XtResourceList resources, Cardinal num_resource
|
||||
|
||||
XtGetSubvalues(base, resources, num_resources, args, num_args);
|
||||
|
||||
- if (num_args != 0) {
|
||||
- XtFree((XtPointer)args);
|
||||
- }
|
||||
+ XtFree((XtPointer)args);
|
||||
}
|
||||
--
|
||||
2.19.2
|
||||
|
25
SOURCES/0002-no-need-to-check-args-for-free.patch
Normal file
25
SOURCES/0002-no-need-to-check-args-for-free.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From 7eeaf69c224d6b7625d9214ba23df7e5e9d50d3c Mon Sep 17 00:00:00 2001
|
||||
From: Walter Harms <wharms@bfs.de>
|
||||
Date: Tue, 8 Jan 2019 22:26:25 +0100
|
||||
Subject: [PATCH 2/9] no need to check args for free
|
||||
|
||||
---
|
||||
src/Alloc.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/Alloc.c b/src/Alloc.c
|
||||
index c9ffce8..754881b 100644
|
||||
--- a/src/Alloc.c
|
||||
+++ b/src/Alloc.c
|
||||
@@ -214,7 +214,7 @@ char *XtCalloc(
|
||||
void XtFree(
|
||||
char *ptr)
|
||||
{
|
||||
- if (ptr != NULL) Xfree(ptr);
|
||||
+ free(ptr);
|
||||
}
|
||||
|
||||
char* __XtMalloc(
|
||||
--
|
||||
2.19.2
|
||||
|
69
SOURCES/0003-resolv-shadows-a-global-declaration.patch
Normal file
69
SOURCES/0003-resolv-shadows-a-global-declaration.patch
Normal file
@ -0,0 +1,69 @@
|
||||
From e91a7c6e2be7fc5bb7eb5b8e9d28b9bcc36f446b Mon Sep 17 00:00:00 2001
|
||||
From: Walter Harms <wharms@bfs.de>
|
||||
Date: Fri, 11 Jan 2019 22:54:47 +0100
|
||||
Subject: [PATCH 3/9] resolv:shadows a global declaration
|
||||
|
||||
---
|
||||
util/makestrs.c | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/util/makestrs.c b/util/makestrs.c
|
||||
index 5764849..488c9bb 100644
|
||||
--- a/util/makestrs.c
|
||||
+++ b/util/makestrs.c
|
||||
@@ -88,7 +88,7 @@ static int solaris_abi_names = FALSE;
|
||||
* commandline. Needed to separate source and build directories.
|
||||
*/
|
||||
static char* includedir = NULL;
|
||||
-static FILE *ifopen(const char *file, const char *mode)
|
||||
+static FILE *ifopen(const char *myfile, const char *mode)
|
||||
{
|
||||
#ifndef HAVE_ASPRINTF
|
||||
size_t len;
|
||||
@@ -97,13 +97,13 @@ static FILE *ifopen(const char *file, const char *mode)
|
||||
FILE *ret;
|
||||
|
||||
if (includedir == NULL)
|
||||
- return fopen(file, mode);
|
||||
+ return fopen(myfile, mode);
|
||||
|
||||
#ifdef HAVE_ASPRINTF
|
||||
- if (asprintf(&buffer, "%s/%s", includedir, file) == -1)
|
||||
+ if (asprintf(&buffer, "%s/%s", includedir, myfile) == -1)
|
||||
return NULL;
|
||||
#else
|
||||
- len = strlen(file) + strlen(includedir) + 1;
|
||||
+ len = strlen(myfile) + strlen(includedir) + 1;
|
||||
buffer = (char*)malloc(len + 1);
|
||||
if (buffer == NULL)
|
||||
return NULL;
|
||||
@@ -622,7 +622,7 @@ static void DoLine(char *buf)
|
||||
}
|
||||
}
|
||||
|
||||
-static void IntelABIIndexEntries (File *file)
|
||||
+static void IntelABIIndexEntries (File *myfile)
|
||||
{
|
||||
Table* t;
|
||||
TableEnt* te;
|
||||
@@ -635,7 +635,7 @@ static void IntelABIIndexEntries (File *file)
|
||||
}
|
||||
}
|
||||
|
||||
-static void DefaultIndexEntries (File *file)
|
||||
+static void DefaultIndexEntries (File *myfile)
|
||||
{
|
||||
Table* t;
|
||||
TableEnt* te;
|
||||
@@ -649,7 +649,7 @@ static void DefaultIndexEntries (File *file)
|
||||
}
|
||||
}
|
||||
|
||||
-static void IndexEntries (File *file, int abi)
|
||||
+static void IndexEntries (File *myfile, int abi)
|
||||
{
|
||||
switch (abi) {
|
||||
case X_SPARC_ABI:
|
||||
--
|
||||
2.19.2
|
||||
|
93
SOURCES/0004-fix-build-when-XT_GEO_TATTLER-is-defined.patch
Normal file
93
SOURCES/0004-fix-build-when-XT_GEO_TATTLER-is-defined.patch
Normal file
@ -0,0 +1,93 @@
|
||||
From 94a56091c648b4d2c922b781a9d5031c45aa1908 Mon Sep 17 00:00:00 2001
|
||||
From: "Thomas E. Dickey" <dickey@invisible-island.net>
|
||||
Date: Tue, 12 Mar 2019 04:34:28 -0400
|
||||
Subject: [PATCH 4/9] fix build when XT_GEO_TATTLER is defined That turns on a
|
||||
debugging feature (activated by a resource setting). Its use of <stdarg.h>
|
||||
was incorrect. Also fix compiler warnings in the related file.
|
||||
|
||||
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
||||
---
|
||||
include/X11/IntrinsicI.h | 1 +
|
||||
src/Intrinsic.c | 16 ++++++++--------
|
||||
2 files changed, 9 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/include/X11/IntrinsicI.h b/include/X11/IntrinsicI.h
|
||||
index 845ab48..6e2396b 100644
|
||||
--- a/include/X11/IntrinsicI.h
|
||||
+++ b/include/X11/IntrinsicI.h
|
||||
@@ -196,6 +196,7 @@ extern void _XtGClistFree(Display *dpy, XtPerDisplay pd);
|
||||
extern void _XtGeoTab (int);
|
||||
extern void _XtGeoTrace (
|
||||
Widget widget,
|
||||
+ const char *,
|
||||
...
|
||||
) _X_ATTRIBUTE_PRINTF(2,3);
|
||||
|
||||
diff --git a/src/Intrinsic.c b/src/Intrinsic.c
|
||||
index 7119b09..450dce7 100644
|
||||
--- a/src/Intrinsic.c
|
||||
+++ b/src/Intrinsic.c
|
||||
@@ -85,13 +85,14 @@ in this Software without prior written authorization from The Open Group.
|
||||
#include <direct.h> /* for _getdrives() */
|
||||
#endif
|
||||
|
||||
+#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
String XtCXtToolkitError = "XtToolkitError";
|
||||
|
||||
Boolean XtIsSubclass(
|
||||
Widget widget,
|
||||
- WidgetClass widgetClass)
|
||||
+ WidgetClass myWidgetClass)
|
||||
{
|
||||
register WidgetClass w;
|
||||
Boolean retval = FALSE;
|
||||
@@ -100,7 +101,7 @@ Boolean XtIsSubclass(
|
||||
LOCK_APP(app);
|
||||
LOCK_PROCESS;
|
||||
for (w = widget->core.widget_class; w != NULL; w = w->core_class.superclass)
|
||||
- if (w == widgetClass) {
|
||||
+ if (w == myWidgetClass) {
|
||||
retval = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -128,7 +129,7 @@ Boolean _XtCheckSubclassFlag(
|
||||
|
||||
Boolean _XtIsSubclassOf(
|
||||
Widget object,
|
||||
- WidgetClass widgetClass,
|
||||
+ WidgetClass myWidgetClass,
|
||||
WidgetClass superClass,
|
||||
_XtXtEnum flag)
|
||||
{
|
||||
@@ -139,7 +140,7 @@ Boolean _XtIsSubclassOf(
|
||||
} else {
|
||||
register WidgetClass c = object->core.widget_class;
|
||||
while (c != superClass) {
|
||||
- if (c == widgetClass) {
|
||||
+ if (c == myWidgetClass) {
|
||||
UNLOCK_PROCESS;
|
||||
return True;
|
||||
}
|
||||
@@ -1566,14 +1567,13 @@ _XtGeoTab (int direction) /* +1 or -1 */
|
||||
|
||||
|
||||
void
|
||||
-_XtGeoTrace (Widget widget, ...)
|
||||
+_XtGeoTrace (Widget widget, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
- char *fmt;
|
||||
int i ;
|
||||
+
|
||||
if (IsTattled(widget)) {
|
||||
- va_start(args, widget);
|
||||
- fmt = va_arg(args, char *);
|
||||
+ va_start(args, fmt);
|
||||
for (i=0; i<n_tab; i++) printf(" ");
|
||||
(void) vprintf(fmt, args);
|
||||
va_end(args);
|
||||
--
|
||||
2.19.2
|
||||
|
378
SOURCES/0005-fix-bug-introduced-by.patch
Normal file
378
SOURCES/0005-fix-bug-introduced-by.patch
Normal file
@ -0,0 +1,378 @@
|
||||
From 6c0cca42baebb5c681f5ee7f940da8d0a1b2613d Mon Sep 17 00:00:00 2001
|
||||
From: "Thomas E. Dickey" <dickey@invisible-island.net>
|
||||
Date: Fri, 15 Mar 2019 20:06:26 -0400
|
||||
Subject: [PATCH 5/9] fix bug introduced by commit
|
||||
57c8b133bbcf38a9a1e345eabeeabe2a3e07c1c8, which modified util/makestrs.c to
|
||||
avoid a shadowing warning of a function parameter versus global variable, but
|
||||
overlooked use of the parameter within the functions. That caused all of the
|
||||
resource strings in Shell.h to have the same value.
|
||||
|
||||
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
||||
---
|
||||
util/makestrs.c | 122 ++++++++++++++++++++++++++++++------------------
|
||||
1 file changed, 76 insertions(+), 46 deletions(-)
|
||||
|
||||
diff --git a/util/makestrs.c b/util/makestrs.c
|
||||
index 488c9bb..e626dee 100644
|
||||
--- a/util/makestrs.c
|
||||
+++ b/util/makestrs.c
|
||||
@@ -35,7 +35,7 @@ typedef struct _TableEnt {
|
||||
struct _TableEnt* next;
|
||||
char* left;
|
||||
char* right;
|
||||
- int offset;
|
||||
+ size_t offset;
|
||||
} TableEnt;
|
||||
|
||||
typedef struct _Table {
|
||||
@@ -44,7 +44,7 @@ typedef struct _Table {
|
||||
TableEnt* tableentcurrent;
|
||||
TableEnt** tableenttail;
|
||||
char* name;
|
||||
- int offset;
|
||||
+ size_t offset;
|
||||
} Table;
|
||||
|
||||
typedef struct _File {
|
||||
@@ -108,7 +108,7 @@ static FILE *ifopen(const char *myfile, const char *mode)
|
||||
if (buffer == NULL)
|
||||
return NULL;
|
||||
|
||||
- snprintf(buffer, len + 1, "%s/%s", includedir, file);
|
||||
+ snprintf(buffer, len + 1, "%s/%s", includedir, myfile);
|
||||
#endif
|
||||
|
||||
ret = fopen(buffer, mode);
|
||||
@@ -123,7 +123,7 @@ static void WriteHeaderProlog (FILE *f, File *phile)
|
||||
TableEnt* te;
|
||||
|
||||
(void) fprintf (f, "#ifdef %s\n", featurestr);
|
||||
- for (t = phile->table; t; t = t->next)
|
||||
+ for (t = phile->table; t; t = t->next) {
|
||||
for (te = t->tableent; te; te = te->next) {
|
||||
if (strcmp (te->left, "RAtom") == 0) {
|
||||
(void) fprintf (f,
|
||||
@@ -135,6 +135,7 @@ static void WriteHeaderProlog (FILE *f, File *phile)
|
||||
prefixstr, te->left, te->right);
|
||||
}
|
||||
}
|
||||
+ }
|
||||
(void) fprintf (f, "%s", "#else\n");
|
||||
}
|
||||
|
||||
@@ -148,10 +149,12 @@ static void IntelABIWriteHeader (FILE *f, File *phile)
|
||||
for (t = phile->table; t; t = t->next) {
|
||||
(void) fprintf (f, "%s %sConst char %s[];\n",
|
||||
externrefstr, conststr ? conststr : fileprotstr, t->name);
|
||||
- for (te = t->tableent; te; te = te->next)
|
||||
+ for (te = t->tableent; te; te = te->next) {
|
||||
(void) fprintf (f,
|
||||
- "#ifndef %s%s\n#define %s%s ((char*)&%s[%d])\n#endif\n",
|
||||
- prefixstr, te->left, prefixstr, te->left, t->name, te->offset);
|
||||
+ "#ifndef %s%s\n#define %s%s ((char*)&%s[%lu])\n#endif\n",
|
||||
+ prefixstr, te->left, prefixstr, te->left, t->name,
|
||||
+ (unsigned long) te->offset);
|
||||
+ }
|
||||
}
|
||||
|
||||
(void) fprintf (f, "#endif /* %s */\n", featurestr);
|
||||
@@ -162,10 +165,12 @@ static void SPARCABIWriteHeader (FILE *f, File *phile)
|
||||
Table* t;
|
||||
TableEnt* te;
|
||||
|
||||
- for (t = phile->table; t; t = t->next)
|
||||
- for (te = t->tableent; te; te = te->next)
|
||||
+ for (t = phile->table; t; t = t->next) {
|
||||
+ for (te = t->tableent; te; te = te->next) {
|
||||
(void) fprintf (f, "#define %s%s \"%s\"\n",
|
||||
prefixstr, te->left, te->right);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
static void FunctionWriteHeader (FILE *f, File *phile)
|
||||
@@ -179,12 +184,14 @@ static void FunctionWriteHeader (FILE *f, File *phile)
|
||||
externrefstr, conststr ? conststr : fileprotstr,
|
||||
phile->table->name);
|
||||
|
||||
- for (t = phile->table; t; t = t->next)
|
||||
- for (te = t->tableent; te; te = te->next)
|
||||
+ for (t = phile->table; t; t = t->next) {
|
||||
+ for (te = t->tableent; te; te = te->next) {
|
||||
(void) fprintf (f,
|
||||
- "#ifndef %s%s\n#define %s%s (%s(%d))\n#endif\n",
|
||||
+ "#ifndef %s%s\n#define %s%s (%s(%lu))\n#endif\n",
|
||||
prefixstr, te->left, prefixstr, te->left, phile->table->name,
|
||||
- te->offset);
|
||||
+ (unsigned long) te->offset);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
(void) fprintf (f, "#endif /* %s */\n", featurestr);
|
||||
}
|
||||
@@ -196,13 +203,15 @@ static void ArrayperWriteHeader (FILE *f, File *phile)
|
||||
|
||||
WriteHeaderProlog (f, phile);
|
||||
|
||||
- for (t = phile->table; t; t = t->next)
|
||||
- for (te = t->tableent; te; te = te->next)
|
||||
+ for (t = phile->table; t; t = t->next) {
|
||||
+ for (te = t->tableent; te; te = te->next) {
|
||||
(void) fprintf (f,
|
||||
"#ifndef %s%s\n%s %sConst char %s%s[];\n#endif\n",
|
||||
prefixstr, te->left,
|
||||
externrefstr, conststr ? conststr : fileprotstr,
|
||||
prefixstr, te->left);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
(void) fprintf (f, "#endif /* %s */\n", featurestr);
|
||||
}
|
||||
@@ -218,12 +227,14 @@ static void DefaultWriteHeader (FILE *f, File *phile)
|
||||
externrefstr, conststr ? conststr : fileprotstr,
|
||||
phile->table->name);
|
||||
|
||||
- for (t = phile->table; t; t = t->next)
|
||||
- for (te = t->tableent; te; te = te->next)
|
||||
+ for (t = phile->table; t; t = t->next) {
|
||||
+ for (te = t->tableent; te; te = te->next) {
|
||||
(void) fprintf (f,
|
||||
- "#ifndef %s%s\n#define %s%s ((char*)&%s[%d])\n#endif\n",
|
||||
+ "#ifndef %s%s\n#define %s%s ((char*)&%s[%lu])\n#endif\n",
|
||||
prefixstr, te->left, prefixstr, te->left, phile->table->name,
|
||||
- te->offset);
|
||||
+ (unsigned long) te->offset);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
(void) fprintf (f, "#endif /* %s */\n", featurestr);
|
||||
}
|
||||
@@ -232,7 +243,7 @@ static void CopyTmplProlog (FILE *tmpl, FILE *f)
|
||||
{
|
||||
char buf[1024];
|
||||
static const char* magic_string = X_MAGIC_STRING;
|
||||
- int magic_string_len = strlen (magic_string);
|
||||
+ size_t magic_string_len = strlen (magic_string);
|
||||
|
||||
while (fgets (buf, sizeof buf, tmpl)) {
|
||||
if (strncmp (buf, magic_string, magic_string_len) == 0) {
|
||||
@@ -316,7 +327,7 @@ static void WriteSourceLine (TableEnt *te, int abi, int fudge)
|
||||
(void) printf ("%s", "\n");
|
||||
}
|
||||
|
||||
-static const char* const_string = "%s %sConst char %s[] = {\n";
|
||||
+#define const_string "%s %sConst char %s[] = {\n"
|
||||
|
||||
static void IntelABIWriteSource (int abi)
|
||||
{
|
||||
@@ -329,8 +340,9 @@ static void IntelABIWriteSource (int abi)
|
||||
for (t = phile->table; t; t = t->next) {
|
||||
(void) printf (const_string, externdefstr,
|
||||
conststr ? conststr : "", t->name);
|
||||
- for (te = t->tableent; te; te = te->next)
|
||||
+ for (te = t->tableent; te; te = te->next) {
|
||||
WriteSourceLine (te, abi, 0);
|
||||
+ }
|
||||
(void) printf ("%s\n\n", "};");
|
||||
}
|
||||
}
|
||||
@@ -347,17 +359,21 @@ static void IntelABIBCWriteSource (int abi)
|
||||
(void) printf (const_string, externdefstr,
|
||||
conststr ? conststr : "", phile->table->name);
|
||||
|
||||
- for (t = phile->table; t; t = t->next)
|
||||
- for (te = t->tableent; te; te = te->next)
|
||||
+ for (t = phile->table; t; t = t->next) {
|
||||
+ for (te = t->tableent; te; te = te->next) {
|
||||
WriteSourceLine (te, abi, t->next ? 1 : 0);
|
||||
+ }
|
||||
+ }
|
||||
(void) printf ("%s\n\n", "};");
|
||||
|
||||
if (phile->table->next) {
|
||||
(void) printf (const_string, externdefstr,
|
||||
conststr ? conststr : "", phile->table->next->name);
|
||||
- for (t = phile->table->next; t; t = t->next)
|
||||
- for (te = t->tableent; te; te = te->next)
|
||||
+ for (t = phile->table->next; t; t = t->next) {
|
||||
+ for (te = t->tableent; te; te = te->next) {
|
||||
WriteSourceLine (te, abi, 0);
|
||||
+ }
|
||||
+ }
|
||||
(void) printf ("%s\n\n", "};");
|
||||
}
|
||||
}
|
||||
@@ -374,9 +390,11 @@ static void FunctionWriteSource (int abi)
|
||||
(void) printf ("static %sConst char _%s[] = {\n",
|
||||
conststr ? conststr : "", phile->table->name);
|
||||
|
||||
- for (t = phile->table; t; t = t->next)
|
||||
- for (te = t->tableent; te; te = te->next)
|
||||
+ for (t = phile->table; t; t = t->next) {
|
||||
+ for (te = t->tableent; te; te = te->next) {
|
||||
WriteSourceLine (te, abi, t->next ? 1 : 0);
|
||||
+ }
|
||||
+ }
|
||||
(void) printf ("%s\n\n", "};");
|
||||
|
||||
(void) printf ("%sConst char* %s(index)\n int index;\n{\n return &_%s[index];\n}\n\n",
|
||||
@@ -394,7 +412,7 @@ static void ArrayperWriteSource (int abi)
|
||||
Table* t;
|
||||
TableEnt* te;
|
||||
|
||||
- for (t = phile->table; t; t = t->next)
|
||||
+ for (t = phile->table; t; t = t->next) {
|
||||
for (te = t->tableent; te; te = te->next) {
|
||||
if (strcmp (te->left, "RAtom") == 0) {
|
||||
if (done_atom) return;
|
||||
@@ -405,6 +423,7 @@ static void ArrayperWriteSource (int abi)
|
||||
prefixstr,
|
||||
te->left, te->right);
|
||||
}
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,9 +438,11 @@ static void DefaultWriteSource (int abi)
|
||||
(void) printf (const_string, externdefstr, conststr ? conststr : "",
|
||||
phile->table->name);
|
||||
|
||||
- for (t = phile->table; t; t = t->next)
|
||||
- for (te = t->tableent; te; te = te->next)
|
||||
+ for (t = phile->table; t; t = t->next) {
|
||||
+ for (te = t->tableent; te; te = te->next) {
|
||||
WriteSourceLine (te, abi, t->next ? 1 : 0);
|
||||
+ }
|
||||
+ }
|
||||
(void) printf ("%s\n\n", "};");
|
||||
}
|
||||
}
|
||||
@@ -457,7 +478,10 @@ static void WriteSource(char *tagline, int abi)
|
||||
|
||||
(*sourceproc[abi])(abi);
|
||||
|
||||
- if (tmpl) CopyTmplEpilog (tmpl, stdout);
|
||||
+ if (tmpl) {
|
||||
+ CopyTmplEpilog (tmpl, stdout);
|
||||
+ fclose(tmpl);
|
||||
+ }
|
||||
}
|
||||
|
||||
static void DoLine(char *buf)
|
||||
@@ -586,9 +610,9 @@ static void DoLine(char *buf)
|
||||
{
|
||||
char* right;
|
||||
TableEnt* tableent;
|
||||
- int llen;
|
||||
- int rlen;
|
||||
- int len;
|
||||
+ size_t llen;
|
||||
+ size_t rlen;
|
||||
+ size_t len;
|
||||
|
||||
if ((right = strchr(buf, ' ')))
|
||||
*right++ = 0;
|
||||
@@ -602,7 +626,8 @@ static void DoLine(char *buf)
|
||||
llen = len = strlen(buf) + 1;
|
||||
rlen = strlen(right) + 1;
|
||||
if (right != buf + 1) len += rlen;
|
||||
- if ((tableent = (TableEnt*)malloc(sizeof(TableEnt) + len)) == NULL)
|
||||
+ tableent = (TableEnt*)calloc(sizeof(TableEnt) + len, 1);
|
||||
+ if (tableent == NULL)
|
||||
exit(1);
|
||||
tableent->left = (char *)(tableent + 1);
|
||||
strcpy(tableent->left, buf);
|
||||
@@ -627,11 +652,12 @@ static void IntelABIIndexEntries (File *myfile)
|
||||
Table* t;
|
||||
TableEnt* te;
|
||||
|
||||
- for (t = file->table; t; t = t->next)
|
||||
+ for (t = myfile->table; t; t = t->next) {
|
||||
for (te = t->tableent; te; te = te->next) {
|
||||
te->offset = t->offset;
|
||||
t->offset += strlen (te->right);
|
||||
t->offset++;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,13 +665,14 @@ static void DefaultIndexEntries (File *myfile)
|
||||
{
|
||||
Table* t;
|
||||
TableEnt* te;
|
||||
- int offset = 0;
|
||||
+ size_t offset = 0;
|
||||
|
||||
- for (t = file->table; t; t = t->next)
|
||||
+ for (t = myfile->table; t; t = t->next) {
|
||||
for (te = t->tableent; te; te = te->next) {
|
||||
te->offset = offset;
|
||||
offset += strlen (te->right);
|
||||
offset++;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,10 +683,10 @@ static void IndexEntries (File *myfile, int abi)
|
||||
break;
|
||||
case X_INTEL_ABI:
|
||||
case X_INTEL_ABI_BC:
|
||||
- IntelABIIndexEntries (file);
|
||||
+ IntelABIIndexEntries (myfile);
|
||||
break;
|
||||
default:
|
||||
- DefaultIndexEntries (file);
|
||||
+ DefaultIndexEntries (myfile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -669,12 +696,12 @@ static char* DoComment (char *line)
|
||||
char* tag;
|
||||
char* eol;
|
||||
char* ret;
|
||||
- int len;
|
||||
+ size_t len;
|
||||
|
||||
/* assume that the first line with two '$' in it is the RCS tag line */
|
||||
if ((tag = strchr (line, '$')) == NULL) return NULL;
|
||||
if ((eol = strchr (tag + 1, '$')) == NULL) return NULL;
|
||||
- len = eol - tag;
|
||||
+ len = (size_t)(eol - tag);
|
||||
if ((ret = malloc (len)) == NULL)
|
||||
exit (1);
|
||||
(void) strncpy (ret, tag + 1, len - 1);
|
||||
@@ -684,7 +711,7 @@ static char* DoComment (char *line)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
- int len, i;
|
||||
+ size_t len;
|
||||
char* tagline = NULL;
|
||||
File* phile;
|
||||
FILE *f;
|
||||
@@ -698,6 +725,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
f = stdin;
|
||||
if (argc > 1) {
|
||||
+ int i;
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp (argv[i], "-f") == 0) {
|
||||
if (++i < argc)
|
||||
@@ -706,10 +734,12 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
if (strcmp (argv[i], "-i") == 0) {
|
||||
- if (++i < argc)
|
||||
+ if (++i < argc) {
|
||||
includedir = argv[i];
|
||||
- else
|
||||
+ } else {
|
||||
+ if (f != 0 && f != stdin) fclose(f);
|
||||
return 1;
|
||||
+ }
|
||||
}
|
||||
if (strcmp (argv[i], "-sparcabi") == 0)
|
||||
abi = X_SPARC_ABI;
|
||||
--
|
||||
2.19.2
|
||||
|
@ -0,0 +1,206 @@
|
||||
From 15ce56425b5e5b89486481fdf7a8b077639f3c78 Mon Sep 17 00:00:00 2001
|
||||
From: "Thomas E. Dickey" <dickey@invisible-island.net>
|
||||
Date: Sun, 17 Mar 2019 20:59:21 -0400
|
||||
Subject: [PATCH 6/9] Use standard size_t type in the casts for
|
||||
length-parameter of memcpy, memmove and bzero. When the library was written
|
||||
(1989), none of those had been standardized, and the source-code used "(int)"
|
||||
casts to help with K&R compilers. The cleanup done in the previous update
|
||||
used binary-compare to validate, which does not work for these because the
|
||||
compiler is recording the cast's effect.
|
||||
|
||||
This change reduces the number of gcc warnings from 163 to 128.
|
||||
|
||||
Signed-off-by: Thomas E. Dickey <dickey@invisible-island.net>
|
||||
---
|
||||
include/X11/IntrinsicI.h | 6 +++---
|
||||
src/Create.c | 6 +++---
|
||||
src/Resources.c | 24 ++++++++++++------------
|
||||
src/SetValues.c | 8 ++++----
|
||||
4 files changed, 22 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/include/X11/IntrinsicI.h b/include/X11/IntrinsicI.h
|
||||
index 6e2396b..c028701 100644
|
||||
--- a/include/X11/IntrinsicI.h
|
||||
+++ b/include/X11/IntrinsicI.h
|
||||
@@ -110,14 +110,14 @@ SOFTWARE.
|
||||
|
||||
#define XtMemmove(dst, src, size) \
|
||||
if ((char *)(dst) != (char *)(src)) { \
|
||||
- (void) memcpy((char *) (dst), (char *) (src), (int) (size)); \
|
||||
+ (void) memcpy((char *) (dst), (char *) (src), (size_t) (size)); \
|
||||
}
|
||||
|
||||
#define XtBZero(dst, size) \
|
||||
- bzero((char *) (dst), (int) (size))
|
||||
+ bzero((char *) (dst), (size_t) (size))
|
||||
|
||||
#define XtMemcmp(b1, b2, size) \
|
||||
- memcmp((char *) (b1), (char *) (b2), (int) (size))
|
||||
+ memcmp((char *) (b1), (char *) (b2), (size_t) (size))
|
||||
|
||||
|
||||
/****************************************************************
|
||||
diff --git a/src/Create.c b/src/Create.c
|
||||
index da00192..bbea9ce 100644
|
||||
--- a/src/Create.c
|
||||
+++ b/src/Create.c
|
||||
@@ -412,14 +412,14 @@ xtCreate(
|
||||
wsize = widget_class->core_class.widget_size;
|
||||
csize = 0;
|
||||
req_widget = (Widget) XtStackAlloc(wsize, widget_cache);
|
||||
- (void) memmove ((char *) req_widget, (char *) widget, (int) wsize);
|
||||
+ (void) memmove ((char *) req_widget, (char *) widget, (size_t) wsize);
|
||||
CallInitialize (XtClass(widget), req_widget, widget, args, num_args);
|
||||
if (parent_constraint_class != NULL) {
|
||||
csize = parent_constraint_class->constraint_class.constraint_size;
|
||||
if (csize) {
|
||||
req_constraints = XtStackAlloc(csize, constraint_cache);
|
||||
(void) memmove((char*)req_constraints, widget->core.constraints,
|
||||
- (int)csize);
|
||||
+ (size_t)csize);
|
||||
req_widget->core.constraints = req_constraints;
|
||||
} else req_widget->core.constraints = NULL;
|
||||
CallConstraintInitialize(parent_constraint_class, req_widget, widget,
|
||||
@@ -778,7 +778,7 @@ _XtCreateHookObj(Screen* screen)
|
||||
CompileCallbacks(hookobj);
|
||||
wsize = hookObjectClass->core_class.widget_size;
|
||||
req_widget = (Widget) XtStackAlloc(wsize, widget_cache);
|
||||
- (void) memmove ((char *) req_widget, (char *) hookobj, (int) wsize);
|
||||
+ (void) memmove ((char *) req_widget, (char *) hookobj, (size_t) wsize);
|
||||
CallInitialize (hookObjectClass, req_widget, hookobj,
|
||||
(ArgList)NULL, (Cardinal) 0);
|
||||
XtStackFree((XtPointer)req_widget, widget_cache);
|
||||
diff --git a/src/Resources.c b/src/Resources.c
|
||||
index 9e0f065..456da7a 100644
|
||||
--- a/src/Resources.c
|
||||
+++ b/src/Resources.c
|
||||
@@ -110,7 +110,7 @@ void _XtCopyFromArg(
|
||||
register unsigned int size)
|
||||
{
|
||||
if (size > sizeof(XtArgVal))
|
||||
- (void) memmove((char *) dst, (char *) src, (int) size);
|
||||
+ (void) memmove((char *) dst, (char *) src, (size_t) size);
|
||||
else {
|
||||
union {
|
||||
long longval;
|
||||
@@ -133,7 +133,7 @@ void _XtCopyFromArg(
|
||||
else if (size == sizeof(char*)) u.charptr = (char*)src;
|
||||
else p = (char*)&src;
|
||||
|
||||
- (void) memmove(dst, p, (int) size);
|
||||
+ (void) memmove(dst, p, (size_t) size);
|
||||
}
|
||||
} /* _XtCopyFromArg */
|
||||
|
||||
@@ -158,7 +158,7 @@ void _XtCopyToArg(
|
||||
XtPointer ptr;
|
||||
} u;
|
||||
if (size <= sizeof(XtArgVal)) {
|
||||
- (void) memmove((char*)&u, (char*)src, (int)size );
|
||||
+ (void) memmove((char*)&u, (char*)src, (size_t)size );
|
||||
if (size == sizeof(long)) *dst = (XtArgVal)u.longval;
|
||||
#ifdef LONG64
|
||||
else if (size == sizeof(int)) *dst = (XtArgVal)u.intval;
|
||||
@@ -167,10 +167,10 @@ void _XtCopyToArg(
|
||||
else if (size == sizeof(char)) *dst = (XtArgVal)u.charval;
|
||||
else if (size == sizeof(char*)) *dst = (XtArgVal)u.charptr;
|
||||
else if (size == sizeof(XtPointer)) *dst = (XtArgVal)u.ptr;
|
||||
- else (void) memmove((char*)dst, (char*)src, (int)size );
|
||||
+ else (void) memmove((char*)dst, (char*)src, (size_t)size );
|
||||
}
|
||||
else
|
||||
- (void) memmove((char*)dst, (char*)src, (int)size );
|
||||
+ (void) memmove((char*)dst, (char*)src, (size_t)size );
|
||||
#else
|
||||
XtErrorMsg("invalidGetValues", "xtGetValues", XtCXtToolkitError,
|
||||
"NULL ArgVal in XtGetValues", (String*) NULL, (Cardinal*) NULL);
|
||||
@@ -178,7 +178,7 @@ void _XtCopyToArg(
|
||||
}
|
||||
else {
|
||||
/* proper GetValues semantics: argval is pointer to destination */
|
||||
- (void) memmove((char*)*dst, (char*)src, (int)size );
|
||||
+ (void) memmove((char*)*dst, (char*)src, (size_t)size );
|
||||
}
|
||||
} /* _XtCopyToArg */
|
||||
|
||||
@@ -202,7 +202,7 @@ static void CopyToArg(
|
||||
XtPointer ptr;
|
||||
} u;
|
||||
if (size <= sizeof(XtArgVal)) {
|
||||
- (void) memmove((char*)&u, (char*)src, (int)size );
|
||||
+ (void) memmove((char*)&u, (char*)src, (size_t)size );
|
||||
if (size == sizeof(long)) *dst = (XtArgVal)u.longval;
|
||||
#ifdef LONG64
|
||||
else if (size == sizeof(int)) *dst = (XtArgVal)u.intval;
|
||||
@@ -211,14 +211,14 @@ static void CopyToArg(
|
||||
else if (size == sizeof(char)) *dst = (XtArgVal)u.charval;
|
||||
else if (size == sizeof(char*)) *dst = (XtArgVal)u.charptr;
|
||||
else if (size == sizeof(XtPointer)) *dst = (XtArgVal)u.ptr;
|
||||
- else (void) memmove((char*)dst, (char*)src, (int)size );
|
||||
+ else (void) memmove((char*)dst, (char*)src, (size_t)size );
|
||||
}
|
||||
else
|
||||
- (void) memmove((char*)dst, (char*)src, (int)size );
|
||||
+ (void) memmove((char*)dst, (char*)src, (size_t)size );
|
||||
}
|
||||
else {
|
||||
/* proper GetValues semantics: argval is pointer to destination */
|
||||
- (void) memmove((char*)*dst, (char*)src, (int)size );
|
||||
+ (void) memmove((char*)*dst, (char*)src, (size_t)size );
|
||||
}
|
||||
} /* CopyToArg */
|
||||
|
||||
@@ -519,8 +519,8 @@ static XtCacheRef *GetResources(
|
||||
}
|
||||
|
||||
/* Mark each resource as not found on arg list */
|
||||
- bzero((char *) found, (int) (num_resources * sizeof(Boolean)));
|
||||
- bzero((char *) typed, (int) (num_resources * sizeof(int)));
|
||||
+ bzero((char *) found, (size_t) (num_resources * sizeof(Boolean)));
|
||||
+ bzero((char *) typed, (size_t) (num_resources * sizeof(int)));
|
||||
|
||||
/* Copy the args into the resources, mark each as found */
|
||||
{
|
||||
diff --git a/src/SetValues.c b/src/SetValues.c
|
||||
index e432ec7..f274000 100644
|
||||
--- a/src/SetValues.c
|
||||
+++ b/src/SetValues.c
|
||||
@@ -224,7 +224,7 @@ void XtSetValues(
|
||||
UNLOCK_PROCESS;
|
||||
oldw = (Widget) XtStackAlloc(widgetSize, oldwCache);
|
||||
reqw = (Widget) XtStackAlloc (widgetSize, reqwCache);
|
||||
- (void) memmove((char *) oldw, (char *) w, (int) widgetSize);
|
||||
+ (void) memmove((char *) oldw, (char *) w, (size_t) widgetSize);
|
||||
|
||||
/* Set resource values */
|
||||
|
||||
@@ -233,7 +233,7 @@ void XtSetValues(
|
||||
wc->core_class.num_resources, args, num_args);
|
||||
UNLOCK_PROCESS;
|
||||
|
||||
- (void) memmove ((char *) reqw, (char *) w, (int) widgetSize);
|
||||
+ (void) memmove ((char *) reqw, (char *) w, (size_t) widgetSize);
|
||||
|
||||
hasConstraints = (XtParent(w) != NULL && !XtIsShell(w) && XtIsConstraint(XtParent(w)));
|
||||
|
||||
@@ -253,7 +253,7 @@ void XtSetValues(
|
||||
oldw->core.constraints = XtStackAlloc(constraintSize, oldcCache);
|
||||
reqw->core.constraints = XtStackAlloc(constraintSize, reqcCache);
|
||||
(void) memmove((char *) oldw->core.constraints,
|
||||
- (char *) w->core.constraints, (int) constraintSize);
|
||||
+ (char *) w->core.constraints, (size_t) constraintSize);
|
||||
|
||||
/* Set constraint values */
|
||||
LOCK_PROCESS;
|
||||
@@ -262,7 +262,7 @@ void XtSetValues(
|
||||
cwc->constraint_class.num_resources, args, num_args);
|
||||
UNLOCK_PROCESS;
|
||||
(void) memmove((char *) reqw->core.constraints,
|
||||
- (char *) w->core.constraints, (int) constraintSize);
|
||||
+ (char *) w->core.constraints, (size_t) constraintSize);
|
||||
}
|
||||
|
||||
/* Inform widget of changes, then inform parent of changes */
|
||||
--
|
||||
2.19.2
|
||||
|
118
SOURCES/0007-Fix-leaks-detected-by-covscan.patch
Normal file
118
SOURCES/0007-Fix-leaks-detected-by-covscan.patch
Normal file
@ -0,0 +1,118 @@
|
||||
From a35bef8c333f3fcf12d66e38ad769bc5f1df16a3 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Tissoires <benjamin.tissoires@gmail.com>
|
||||
Date: Thu, 11 Apr 2019 17:26:58 +0200
|
||||
Subject: [PATCH 7/9] Fix leaks detected by covscan
|
||||
|
||||
The following leaks are reported by covscan:
|
||||
|
||||
Error: RESOURCE_LEAK (CWE-772):
|
||||
libXt-20190411/src/ResConfig.c:542: alloc_arg: "_get_part" allocates memory that is stored into "part".
|
||||
libXt-20190411/src/ResConfig.c:544: noescape: Resource "part" is not freed or pointed-to in "_match_resource_to_widget".
|
||||
libXt-20190411/src/ResConfig.c:560: leaked_storage: Variable "part" going out of scope leaks the storage it points to.
|
||||
|
||||
Error: RESOURCE_LEAK (CWE-772):
|
||||
libXt-20190411/src/TMgrab.c:108: alloc_arg: "XtKeysymToKeycodeList" allocates memory that is stored into "keycodes".
|
||||
libXt-20190411/src/TMgrab.c:115: var_assign: Assigning: "keycodeP" = "keycodes".
|
||||
libXt-20190411/src/TMgrab.c:124: leaked_storage: Variable "keycodeP" going out of scope leaks the storage it points to.
|
||||
libXt-20190411/src/TMgrab.c:124: leaked_storage: Variable "keycodes" going out of scope leaks the storage it points to.
|
||||
|
||||
Error: RESOURCE_LEAK (CWE-772):
|
||||
libXt-20190411/src/TMparse.c:1544: alloc_fn: Storage is returned from allocation function "XtMalloc".
|
||||
libXt-20190411/src/TMparse.c:1544: var_assign: Assigning: "event" = storage returned from "XtMalloc(88U)".
|
||||
libXt-20190411/src/TMparse.c:1549: noescape: Resource "event" is not freed or pointed-to in "ParseQuotedStringEvent".
|
||||
libXt-20190411/src/TMparse.c:1555: leaked_storage: Variable "event" going out of scope leaks the storage it points to.
|
||||
|
||||
Error: RESOURCE_LEAK (CWE-772):
|
||||
libXt-20190411/src/TMparse.c:1779: alloc_fn: Storage is returned from allocation function "XtMalloc".
|
||||
libXt-20190411/src/TMparse.c:1779: var_assign: Assigning: "action" = storage returned from "XtMalloc(32U)".
|
||||
libXt-20190411/src/TMparse.c:1784: noescape: Resource "action" is not freed or pointed-to in "ParseAction".
|
||||
libXt-20190411/src/TMparse.c:1785: leaked_storage: Variable "action" going out of scope leaks the storage it points to.
|
||||
|
||||
In addition to this legitimate leaks, covscan can get confused by
|
||||
the allocated memory in XtKeysymToKeycodeList:
|
||||
|
||||
Error: RESOURCE_LEAK (CWE-772):
|
||||
libXt-20190411/src/TMgrab.c:108: alloc_arg: "XtKeysymToKeycodeList" allocates memory that is stored into "keycodes".
|
||||
libXt-20190411/src/TMgrab.c:114: leaked_storage: Variable "keycodes" going out of scope leaks the storage it points to.
|
||||
|
||||
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
|
||||
---
|
||||
src/ResConfig.c | 1 +
|
||||
src/TMgrab.c | 10 ++++++++--
|
||||
src/TMparse.c | 6 +++++-
|
||||
3 files changed, 14 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/ResConfig.c b/src/ResConfig.c
|
||||
index 5a7f6d2..bd6792c 100644
|
||||
--- a/src/ResConfig.c
|
||||
+++ b/src/ResConfig.c
|
||||
@@ -557,6 +557,7 @@ _set_and_search (
|
||||
} else
|
||||
_search_child (w, local_index, remainder,
|
||||
resource, value, last_token, last_part);
|
||||
+ XtFree (part);
|
||||
return;
|
||||
}
|
||||
if (token == '*') {
|
||||
diff --git a/src/TMgrab.c b/src/TMgrab.c
|
||||
index 08cb486..4e7d20d 100644
|
||||
--- a/src/TMgrab.c
|
||||
+++ b/src/TMgrab.c
|
||||
@@ -105,13 +105,17 @@ static void GrabAllCorrectKeys(
|
||||
careOn |= modMatch->modifiers;
|
||||
careMask |= modMatch->modifierMask;
|
||||
|
||||
+ keycodes = NULL;
|
||||
XtKeysymToKeycodeList(
|
||||
dpy,
|
||||
(KeySym)typeMatch->eventCode,
|
||||
&keycodes,
|
||||
&keycount
|
||||
);
|
||||
- if (keycount == 0) return;
|
||||
+ if (keycount == 0) {
|
||||
+ XtFree((char *)keycodes);
|
||||
+ return;
|
||||
+ }
|
||||
for (keycodeP = keycodes; keycount--; keycodeP++) {
|
||||
if (modMatch->standard) {
|
||||
/* find standard modifiers that produce this keysym */
|
||||
@@ -120,8 +124,10 @@ static void GrabAllCorrectKeys(
|
||||
Modifiers modifiers_return;
|
||||
XtTranslateKeycode( dpy, *keycodeP, (Modifiers)0,
|
||||
&modifiers_return, &keysym );
|
||||
- if (careOn & modifiers_return)
|
||||
+ if (careOn & modifiers_return) {
|
||||
+ XtFree((char *)keycodes);
|
||||
return;
|
||||
+ }
|
||||
if (keysym == typeMatch->eventCode) {
|
||||
XtGrabKey(widget, *keycodeP, careOn,
|
||||
grabP->owner_events,
|
||||
diff --git a/src/TMparse.c b/src/TMparse.c
|
||||
index df94181..086f53d 100644
|
||||
--- a/src/TMparse.c
|
||||
+++ b/src/TMparse.c
|
||||
@@ -1551,6 +1551,7 @@ static String ParseEventSeq(
|
||||
XtCXtToolkitError,
|
||||
"... probably due to non-Latin1 character in quoted string",
|
||||
(String*)NULL, (Cardinal*)NULL);
|
||||
+ XtFree((char *)event);
|
||||
return PanicModeRecovery(str);
|
||||
}
|
||||
*nextEvent = event;
|
||||
@@ -1781,7 +1782,10 @@ static String ParseActionSeq(
|
||||
action->next = NULL;
|
||||
|
||||
str = ParseAction(str, action, &quark, error);
|
||||
- if (*error) return PanicModeRecovery(str);
|
||||
+ if (*error) {
|
||||
+ XtFree((char *)action);
|
||||
+ return PanicModeRecovery(str);
|
||||
+ }
|
||||
|
||||
action->idx = _XtGetQuarkIndex(parseTree, quark);
|
||||
ScanWhitespace(str);
|
||||
--
|
||||
2.19.2
|
||||
|
59
SOURCES/0008-dummy-fix-for-covscan.patch
Normal file
59
SOURCES/0008-dummy-fix-for-covscan.patch
Normal file
@ -0,0 +1,59 @@
|
||||
From a9e6eecdd61b43367d5b7873532952db54b1b124 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Tissoires <benjamin.tissoires@gmail.com>
|
||||
Date: Thu, 11 Apr 2019 17:27:12 +0200
|
||||
Subject: [PATCH 8/9] dummy fix for covscan
|
||||
|
||||
covscan seems lost here:
|
||||
|
||||
Error: RESOURCE_LEAK (CWE-772):
|
||||
libXt-20190411/src/Intrinsic.c:1074: alloc_fn: Storage is returned from allocation function "__XtMalloc".
|
||||
libXt-20190411/src/Intrinsic.c:1074: var_assign: Assigning: "buf2" = storage returned from "__XtMalloc(4096U)".
|
||||
libXt-20190411/src/Intrinsic.c:1110: leaked_storage: Variable "buf2" going out of scope leaks the storage it points to.
|
||||
|
||||
Error: USE_AFTER_FREE (CWE-416):
|
||||
libXt-20190411/src/Intrinsic.c:1113: alias: Assigning: "buf" = "buf2". Now both point to the same storage.
|
||||
libXt-20190411/src/Intrinsic.c:1108: freed_arg: "XtFree" frees "buf2".
|
||||
libXt-20190411/src/Intrinsic.c:1110: use_after_free: Using freed pointer "buf".
|
||||
|
||||
Both are false positive, but we can make it understand where it
|
||||
is wrong.
|
||||
|
||||
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
|
||||
---
|
||||
src/Intrinsic.c | 12 ++++++++----
|
||||
1 file changed, 8 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/Intrinsic.c b/src/Intrinsic.c
|
||||
index 450dce7..3a16d5e 100644
|
||||
--- a/src/Intrinsic.c
|
||||
+++ b/src/Intrinsic.c
|
||||
@@ -1070,8 +1070,9 @@ String XtFindFile(
|
||||
int len;
|
||||
Boolean firstTime = TRUE;
|
||||
|
||||
- buf = buf1 = __XtMalloc((unsigned)PATH_MAX);
|
||||
+ buf1 = __XtMalloc((unsigned)PATH_MAX);
|
||||
buf2 = __XtMalloc((unsigned)PATH_MAX);
|
||||
+ buf = buf1;
|
||||
|
||||
if (predicate == NULL) predicate = TestFile;
|
||||
|
||||
@@ -1105,9 +1106,12 @@ String XtFindFile(
|
||||
#ifdef XNL_DEBUG
|
||||
printf("File found.\n");
|
||||
#endif /* XNL_DEBUG */
|
||||
- if (buf == buf1) XtFree(buf2);
|
||||
- else XtFree(buf1);
|
||||
- return buf;
|
||||
+ if (buf == buf1) {
|
||||
+ XtFree(buf2);
|
||||
+ return buf1;
|
||||
+ }
|
||||
+ XtFree(buf1);
|
||||
+ return buf2;
|
||||
}
|
||||
if (buf == buf1)
|
||||
buf = buf2;
|
||||
--
|
||||
2.19.2
|
||||
|
69
SOURCES/0009-Fix-covscan-complain.patch
Normal file
69
SOURCES/0009-Fix-covscan-complain.patch
Normal file
@ -0,0 +1,69 @@
|
||||
From fa2acae4f13209aaefa5a38d046aca3da545fe63 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Tissoires <benjamin.tissoires@gmail.com>
|
||||
Date: Thu, 11 Apr 2019 17:21:17 +0200
|
||||
Subject: [PATCH 9/9] Fix covscan complain
|
||||
|
||||
covscan gets confused by the test before the XtFree.
|
||||
|
||||
Error: RESOURCE_LEAK (CWE-772):
|
||||
libXt-20190411/src/Event.c:743: alloc_fn: Storage is returned from allocation function "__XtMalloc".
|
||||
libXt-20190411/src/Event.c:743: var_assign: Assigning: "proc" = storage returned from "__XtMalloc((Cardinal)((size_t)numprocs * 16UL))".
|
||||
libXt-20190411/src/Event.c:745: var_assign: Assigning: "closure" = "proc".
|
||||
libXt-20190411/src/Event.c:776: leaked_storage: Variable "closure" going out of scope leaks the storage it points to.
|
||||
libXt-20190411/src/Event.c:776: leaked_storage: Variable "proc" going out of scope leaks the storage it points to.
|
||||
|
||||
Mixing static arrays and dynamic ones was a good idea
|
||||
in the 90s when malloc was expensive, but now, we should
|
||||
probably make the code clearer by just allocating the
|
||||
memory when needed.
|
||||
|
||||
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
|
||||
---
|
||||
src/Event.c | 17 +++++------------
|
||||
1 file changed, 5 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/Event.c b/src/Event.c
|
||||
index 11823d6..c01b65d 100644
|
||||
--- a/src/Event.c
|
||||
+++ b/src/Event.c
|
||||
@@ -725,8 +725,6 @@ static Boolean CallEventHandlers(
|
||||
register XtEventRec *p;
|
||||
XtEventHandler *proc;
|
||||
XtPointer *closure;
|
||||
- XtEventHandler procs[EHMAXSIZE];
|
||||
- XtPointer closures[EHMAXSIZE];
|
||||
Boolean cont_to_disp = True;
|
||||
int i, numprocs;
|
||||
|
||||
@@ -739,14 +737,10 @@ static Boolean CallEventHandlers(
|
||||
(p->has_type_specifier && event->type == EXT_TYPE(p)))
|
||||
numprocs++;
|
||||
}
|
||||
- if (numprocs > EHMAXSIZE) {
|
||||
- proc = (XtEventHandler *)__XtMalloc(numprocs * (sizeof(XtEventHandler) +
|
||||
- sizeof(XtPointer)));
|
||||
- closure = (XtPointer *)(proc + numprocs);
|
||||
- } else {
|
||||
- proc = procs;
|
||||
- closure = closures;
|
||||
- }
|
||||
+ proc = (XtEventHandler *)__XtMalloc(numprocs * (sizeof(XtEventHandler) +
|
||||
+ sizeof(XtPointer)));
|
||||
+ closure = (XtPointer *)(proc + numprocs);
|
||||
+
|
||||
numprocs = 0;
|
||||
for (p=widget->core.event_table; p; p = p->next) {
|
||||
if ((!p->has_type_specifier && (mask & p->mask)) ||
|
||||
@@ -771,8 +765,7 @@ static Boolean CallEventHandlers(
|
||||
*/
|
||||
for (i = 0; i < numprocs && cont_to_disp; i++)
|
||||
(*(proc[i]))(widget, closure[i], event, &cont_to_disp);
|
||||
- if (numprocs > EHMAXSIZE)
|
||||
- XtFree((char *)proc);
|
||||
+ XtFree((char *)proc);
|
||||
return cont_to_disp;
|
||||
}
|
||||
|
||||
--
|
||||
2.19.2
|
||||
|
@ -5,9 +5,8 @@
|
||||
Summary: X.Org X11 libXt runtime library
|
||||
Name: libXt
|
||||
Version: 1.1.5
|
||||
Release: 8%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
|
||||
Release: 12%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist}
|
||||
License: MIT
|
||||
Group: System Environment/Libraries
|
||||
URL: http://www.x.org
|
||||
|
||||
%if 0%{?gitdate}
|
||||
@ -18,6 +17,16 @@ Source2: commitid
|
||||
Source0: http://xorg.freedesktop.org/archive/individual/lib/%{name}-%{version}.tar.bz2
|
||||
%endif
|
||||
|
||||
Patch1: 0001-no-need-to-check-XFree-arguments.patch
|
||||
Patch2: 0002-no-need-to-check-args-for-free.patch
|
||||
Patch3: 0003-resolv-shadows-a-global-declaration.patch
|
||||
Patch4: 0004-fix-build-when-XT_GEO_TATTLER-is-defined.patch
|
||||
Patch5: 0005-fix-bug-introduced-by.patch
|
||||
Patch6: 0006-Use-standard-size_t-type-in-the-casts-for-length-par.patch
|
||||
Patch7: 0007-Fix-leaks-detected-by-covscan.patch
|
||||
Patch8: 0008-dummy-fix-for-covscan.patch
|
||||
Patch9: 0009-Fix-covscan-complain.patch
|
||||
|
||||
Requires: libX11%{?_isa} >= 1.5.99.902
|
||||
|
||||
BuildRequires: xorg-x11-util-macros
|
||||
@ -30,7 +39,6 @@ X.Org X11 libXt runtime library
|
||||
|
||||
%package devel
|
||||
Summary: X.Org X11 libXt development package
|
||||
Group: Development/Libraries
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
@ -38,6 +46,15 @@ X.Org X11 libXt development package
|
||||
|
||||
%prep
|
||||
%setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}
|
||||
%patch1 -p1 -b .git_102ba41a668568d7e7e506b0ab9f064d1f2c4ec5
|
||||
%patch2 -p1 -b .git_12eda76f2c7ff5d43dd68d7ff0ebc29cf27e9897
|
||||
%patch3 -p1 -b .git_57c8b133bbcf38a9a1e345eabeeabe2a3e07c1c8
|
||||
%patch4 -p1 -b .git_fe32434ab1a6a85d222b15e730fed9a5d8a74a2d
|
||||
%patch5 -p1 -b .git_283db645c56a5aa55af1665c309182e492a3c863
|
||||
%patch6 -p1 -b .git_91c08f4d9cb915d5f7c3074db3e72ad15ec14c01
|
||||
%patch7 -p1 -b .git_bca67f981dd3bcf730ac3816836b66049dd09f33
|
||||
%patch8 -p1 -b .git_6a7584e0337bb5cfec7f786231597f46c6d5fb16
|
||||
%patch9 -p1 -b .git_ba4ec937680ee72f2fcd463752766340a4b3729d
|
||||
|
||||
%build
|
||||
autoreconf -v --install --force
|
||||
@ -109,6 +126,18 @@ cp -p COPYING ${RPM_BUILD_ROOT}%{_datadir}/doc/%{name}/COPYING
|
||||
%{_mandir}/man3/*.3*
|
||||
|
||||
%changelog
|
||||
* Tue Jun 4 2019 Olivier Fourdan <ofourdan@redhat.com> - 1.1.5-12
|
||||
- Bump version for gating
|
||||
|
||||
* Fri Apr 12 2019 Benjamin Tissoires - 1.1.5-11
|
||||
- add covscan fixes
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.5-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.5-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Fri Jun 29 2018 Adam Jackson <ajax@redhat.com> - 1.1.5-8
|
||||
- Use ldconfig scriptlet macros
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user