import yelp-3.28.1-3.el8

This commit is contained in:
CentOS Sources 2020-10-05 22:09:24 +00:00 committed by Andrew Lukoshko
commit 17f97ac656
23 changed files with 2354 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/yelp-3.28.1.tar.xz

1
.yelp.metadata Normal file
View File

@ -0,0 +1 @@
2781090d6dc3227212de46b04de88c92053b8340 SOURCES/yelp-3.28.1.tar.xz

View File

@ -0,0 +1,30 @@
From 18a82693d550f4d19c4310741dc60cfef605079a Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 09:01:18 +0200
Subject: [PATCH 01/17] Add gnu_printf format attribute to yelp_debug
yelp-3.28.1/libyelp/yelp-debug.c:150:3: warning: function 'yelp_debug' might be
a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
---
libyelp/yelp-debug.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libyelp/yelp-debug.h b/libyelp/yelp-debug.h
index 620a4bf1..18c5582e 100644
--- a/libyelp/yelp-debug.h
+++ b/libyelp/yelp-debug.h
@@ -67,8 +67,9 @@ typedef enum {
#endif
G_GNUC_INTERNAL
-void yelp_debug (const gchar *file, guint line,
- const gchar *function, guint flags, const gchar *format, ...);
+void yelp_debug (const gchar *file, guint line,
+ const gchar *function, guint flags,
+ const gchar *format, ...) __attribute__ ((format (gnu_printf, 5, 6)));
G_END_DECLS
--
2.19.1

View File

@ -0,0 +1,26 @@
From c323dd5087a15cb2b820fedf311ca288ec347878 Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Thu, 8 Nov 2012 22:57:12 -0500
Subject: [PATCH] Center new windows
This makes more sense than letting mutter put them in the top
left corner.
---
src/yelp-application.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/yelp-application.c b/src/yelp-application.c
index 2d004c2..e669661 100644
--- a/src/yelp-application.c
+++ b/src/yelp-application.c
@@ -444,6 +444,7 @@ application_uri_resolved (YelpUri *uri,
g_settings_get (settings, "geometry", "(ii)", &width, &height);
window = yelp_window_new (data->app);
+ gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size (GTK_WINDOW (window), width, height);
g_signal_connect (window, "resized", G_CALLBACK (window_resized), data->app);
priv->windows = g_slist_prepend (priv->windows, window);
--
1.7.12.1

View File

@ -0,0 +1,185 @@
From b8fdfcae060bdffb15d81e68cdff011105013eb0 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@igalia.com>
Date: Fri, 18 May 2018 09:56:16 -0500
Subject: [PATCH] Fix build with GCC 8
Yelp enables -Werror by default, so it's responsible for predicting and
fixing future compiler warnings that only an oracle could know about. In
this case, that turned out to be -Werror=cast-function-type.
---
libyelp/yelp-docbook-document.c | 6 +++---
libyelp/yelp-document.c | 4 ++--
libyelp/yelp-help-list.c | 2 +-
libyelp/yelp-info-document.c | 2 +-
libyelp/yelp-mallard-document.c | 6 +++---
libyelp/yelp-man-document.c | 2 +-
libyelp/yelp-simple-document.c | 2 +-
libyelp/yelp-transform.c | 2 +-
libyelp/yelp-uri.c | 2 +-
9 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/libyelp/yelp-docbook-document.c b/libyelp/yelp-docbook-document.c
index 9b430b09..6ecaf316 100644
--- a/libyelp/yelp-docbook-document.c
+++ b/libyelp/yelp-docbook-document.c
@@ -273,7 +273,7 @@ docbook_request_page (YelpDocument *document,
priv->process_running = TRUE;
g_object_ref (document);
priv->thread = g_thread_new ("docbook-page",
- (GThreadFunc) docbook_process,
+ (GThreadFunc)(GCallback) docbook_process,
document);
break;
case DOCBOOK_STATE_PARSING:
@@ -495,7 +495,7 @@ docbook_reload (YelpDocbookDocument *docbook)
priv->process_running = TRUE;
g_object_ref (docbook);
priv->thread = g_thread_new ("docbook-reload",
- (GThreadFunc) docbook_process,
+ (GThreadFunc)(GCallback) docbook_process,
docbook);
g_mutex_unlock (&priv->mutex);
@@ -1077,7 +1077,7 @@ docbook_index (YelpDocument *document)
priv = GET_PRIV (document);
g_object_ref (document);
priv->index = g_thread_new ("docbook-index",
- (GThreadFunc) docbook_index_threaded,
+ (GThreadFunc)(GCallback) docbook_index_threaded,
document);
priv->index_running = TRUE;
}
diff --git a/libyelp/yelp-document.c b/libyelp/yelp-document.c
index 6adbbb1d..c1eec9cc 100644
--- a/libyelp/yelp-document.c
+++ b/libyelp/yelp-document.c
@@ -330,7 +330,7 @@ yelp_document_dispose (GObject *object)
if (document->priv->reqs_all) {
g_slist_foreach (document->priv->reqs_all,
- (GFunc) request_try_free,
+ (GFunc)(GCallback) request_try_free,
NULL);
g_slist_free (document->priv->reqs_all);
document->priv->reqs_all = NULL;
@@ -338,7 +338,7 @@ yelp_document_dispose (GObject *object)
if (document->priv->reqs_search) {
g_slist_foreach (document->priv->reqs_search,
- (GFunc) request_try_free,
+ (GFunc)(GCallback) request_try_free,
NULL);
g_slist_free (document->priv->reqs_search);
document->priv->reqs_search = NULL;
diff --git a/libyelp/yelp-help-list.c b/libyelp/yelp-help-list.c
index 9005e48f..cbac98bf 100644
--- a/libyelp/yelp-help-list.c
+++ b/libyelp/yelp-help-list.c
@@ -210,7 +210,7 @@ help_list_request_page (YelpDocument *document,
priv->process_running = TRUE;
g_object_ref (document);
priv->thread = g_thread_new ("helplist-page",
- (GThreadFunc) help_list_think,
+ (GThreadFunc)(GCallback) help_list_think,
document);
}
priv->pending = g_slist_prepend (priv->pending, g_strdup (page_id));
diff --git a/libyelp/yelp-info-document.c b/libyelp/yelp-info-document.c
index 7b532744..d55be325 100644
--- a/libyelp/yelp-info-document.c
+++ b/libyelp/yelp-info-document.c
@@ -209,7 +209,7 @@ info_request_page (YelpDocument *document,
priv->process_running = TRUE;
g_object_ref (document);
priv->thread = g_thread_new ("info-page",
- (GThreadFunc) info_document_process,
+ (GThreadFunc)(GCallback) info_document_process,
document);
break;
case INFO_STATE_PARSING:
diff --git a/libyelp/yelp-mallard-document.c b/libyelp/yelp-mallard-document.c
index fc7c4d7c..74fc80ee 100644
--- a/libyelp/yelp-mallard-document.c
+++ b/libyelp/yelp-mallard-document.c
@@ -287,7 +287,7 @@ mallard_request_page (YelpDocument *document,
priv->thread_running = TRUE;
g_object_ref (document);
priv->thread = g_thread_new ("mallard-page",
- (GThreadFunc) mallard_think,
+ (GThreadFunc)(GCallback) mallard_think,
document);
}
@@ -1100,7 +1100,7 @@ mallard_index (YelpDocument *document)
priv = GET_PRIV (document);
g_object_ref (document);
priv->index = g_thread_new ("mallard-index",
- (GThreadFunc) mallard_index_threaded,
+ (GThreadFunc)(GCallback) mallard_index_threaded,
document);
priv->index_running = TRUE;
}
@@ -1148,7 +1148,7 @@ mallard_monitor_changed (GFileMonitor *monitor,
priv->thread_running = TRUE;
g_object_ref (mallard);
priv->thread = g_thread_new ("mallard-reload",
- (GThreadFunc) mallard_think,
+ (GThreadFunc)(GCallback) mallard_think,
mallard);
g_mutex_unlock (&priv->mutex);
diff --git a/libyelp/yelp-man-document.c b/libyelp/yelp-man-document.c
index 4e165d57..ad7fab4f 100644
--- a/libyelp/yelp-man-document.c
+++ b/libyelp/yelp-man-document.c
@@ -243,7 +243,7 @@ man_request_page (YelpDocument *document,
yelp_document_set_page_id (document, priv->page_id, priv->page_id);
yelp_document_set_root_id (document, priv->page_id, priv->page_id);
priv->thread = g_thread_new ("man-page",
- (GThreadFunc) man_document_process,
+ (GThreadFunc)(GCallback) man_document_process,
document);
break;
case MAN_STATE_PARSING:
diff --git a/libyelp/yelp-simple-document.c b/libyelp/yelp-simple-document.c
index 501d7881..595efa83 100644
--- a/libyelp/yelp-simple-document.c
+++ b/libyelp/yelp-simple-document.c
@@ -131,7 +131,7 @@ yelp_simple_document_dispose (GObject *object)
YelpSimpleDocument *document = YELP_SIMPLE_DOCUMENT (object);
if (document->priv->reqs) {
- g_slist_foreach (document->priv->reqs, (GFunc) request_try_free, NULL);
+ g_slist_foreach (document->priv->reqs, (GFunc)(GCallback) request_try_free, NULL);
g_slist_free (document->priv->reqs);
document->priv->reqs = NULL;
}
diff --git a/libyelp/yelp-transform.c b/libyelp/yelp-transform.c
index 334438af..7a5dc86e 100644
--- a/libyelp/yelp-transform.c
+++ b/libyelp/yelp-transform.c
@@ -298,7 +298,7 @@ yelp_transform_start (YelpTransform *transform,
priv->running = TRUE;
g_object_ref (transform);
priv->thread = g_thread_new ("transform-run",
- (GThreadFunc) transform_run,
+ (GThreadFunc)(GCallback) transform_run,
transform);
g_mutex_unlock (&priv->mutex);
diff --git a/libyelp/yelp-uri.c b/libyelp/yelp-uri.c
index 317beead..f20b167e 100644
--- a/libyelp/yelp-uri.c
+++ b/libyelp/yelp-uri.c
@@ -298,7 +298,7 @@ resolve_start (YelpUri *uri)
if (priv->resolver == NULL) {
g_object_ref (uri);
priv->resolver = g_thread_new ("uri-resolve",
- (GThreadFunc) resolve_async,
+ (GThreadFunc)(GCallback) resolve_async,
uri);
}
}
--
2.17.1

View File

@ -0,0 +1,63 @@
From 3b4245db2e954675d15f50a0e9d004e62a43a48c Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 09:50:53 +0200
Subject: [PATCH 02/17] Check whether document has a root element before
accessing it.
yelp-3.28.1/libyelp/yelp-docbook-document.c:562:13: note: Access to field 'ns' results in a dereference of a null pointer (loaded from field 'xmlcur')
if (priv->xmlcur->ns) {
^ ~~~~~~
560| * unique value, and insert it into the in-memory tree */
561| g_snprintf (autoidstr, 20, "//autoid-%d", ++autoid);
562|-> if (priv->xmlcur->ns) {
563| xmlNewNsProp (priv->xmlcur,
564| xmlNewNs (priv->xmlcur, XML_XML_NAMESPACE, BAD_CAST "xml"),
yelp-3.28.1/libyelp/yelp-docbook-document.c:608:16: note: Access to field 'children' results in a dereference of a null pointer (loaded from field 'xmlcur')
for (cur = priv->xmlcur->children; cur; cur = cur->next) {
^ ~~~~~~
606| NULL);
607|
608|-> for (cur = priv->xmlcur->children; cur; cur = cur->next) {
609| if (cur->type == XML_ELEMENT_NODE) {
610| priv->xmlcur = cur;
---
libyelp/yelp-docbook-document.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/libyelp/yelp-docbook-document.c b/libyelp/yelp-docbook-document.c
index 6ecaf316..24746248 100644
--- a/libyelp/yelp-docbook-document.c
+++ b/libyelp/yelp-docbook-document.c
@@ -309,6 +309,7 @@ docbook_process (YelpDocbookDocument *docbook)
GFile *file = NULL;
gchar *filepath = NULL;
xmlDocPtr xmldoc = NULL;
+ xmlNodePtr xmlcur = NULL;
xmlChar *id = NULL;
xmlParserCtxtPtr parserCtxt = NULL;
GError *error;
@@ -343,7 +344,10 @@ docbook_process (YelpDocbookDocument *docbook)
XML_PARSE_DTDLOAD | XML_PARSE_NOCDATA |
XML_PARSE_NOENT | XML_PARSE_NONET );
- if (xmldoc == NULL) {
+ if (xmldoc)
+ xmlcur = xmlDocGetRootElement (xmldoc);
+
+ if (xmldoc == NULL || xmlcur == NULL) {
error = g_error_new (YELP_ERROR, YELP_ERROR_PROCESSING,
_("The file %s could not be parsed because it is"
" not a well-formed XML document."),
@@ -374,7 +378,7 @@ docbook_process (YelpDocbookDocument *docbook)
priv->max_depth = 1;
priv->xmldoc = xmldoc;
- priv->xmlcur = xmlDocGetRootElement (xmldoc);
+ priv->xmlcur = xmlcur;
id = xmlGetProp (priv->xmlcur, BAD_CAST "id");
if (!id)
--
2.19.1

View File

@ -0,0 +1,44 @@
From 05fd1b7d267d83ad73f67bb99aac5c9ba069d4e5 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 10:09:43 +0200
Subject: [PATCH 03/17] Check whether the index variable is valid before
dereferencing it
yelp-3.28.1/libyelp/yelp-docbook-document.c:1058: check_after_deref: Null-checking "index" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
yelp-3.28.1/libyelp/yelp-docbook-document.c:1026: deref_ptr: Directly dereferencing pointer "index".
yelp-3.28.1/libyelp/yelp-docbook-document.c:1054: deref_ptr: Directly dereferencing pointer "index".
1052| if (filename != NULL)
1053| g_free (filename);
1054|-> if (index->doc != NULL)
1055| xmlFreeDoc (index->doc);
1056| if (index->doc_uri != NULL)
---
libyelp/yelp-docbook-document.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libyelp/yelp-docbook-document.c b/libyelp/yelp-docbook-document.c
index 24746248..afb49fb0 100644
--- a/libyelp/yelp-docbook-document.c
+++ b/libyelp/yelp-docbook-document.c
@@ -1055,12 +1055,13 @@ docbook_index_threaded (YelpDocbookDocument *docbook)
g_object_unref (file);
if (filename != NULL)
g_free (filename);
- if (index->doc != NULL)
- xmlFreeDoc (index->doc);
- if (index->doc_uri != NULL)
- g_free (index->doc_uri);
- if (index != NULL)
+ if (index != NULL) {
+ if (index->doc != NULL)
+ xmlFreeDoc (index->doc);
+ if (index->doc_uri != NULL)
+ g_free (index->doc_uri);
g_free (index);
+ }
if (parserCtxt != NULL)
xmlFreeParserCtxt (parserCtxt);
--
2.19.1

View File

@ -0,0 +1,134 @@
From 3ce3334e9f64eb9eb9f6f52608ca00c2fb74b516 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 10:30:35 +0200
Subject: [PATCH 04/17] Correctly check whether virtual method is implemented
before calling it
yelp-3.28.1/libyelp/yelp-document.c:819:27: warning: Access to field 'request_page' results in a dereference of a null pointer (loaded from field 'g_class')
g_return_val_if_fail (YELP_DOCUMENT_GET_CLASS (document)->request_page != NULL, FALSE);
yelp-3.28.1/libyelp/yelp-document.c:943:27: warning: Access to field 'read_contents' results in a dereference of a null pointer (loaded from field 'g_class')
g_return_val_if_fail (YELP_DOCUMENT_GET_CLASS (document)->read_contents != NULL, NULL);
yelp-3.28.1/libyelp/yelp-document.c:1100:23: warning: Access to field 'finish_read' results in a dereference of a null pointer (loaded from field 'g_class')
g_return_if_fail (YELP_DOCUMENT_GET_CLASS (document)->finish_read != NULL);
yelp-3.28.1/libyelp/yelp-document.c:1141:27: warning: Access to field 'get_mime_type' results in a dereference of a null pointer (loaded from field 'g_class')
g_return_val_if_fail (YELP_DOCUMENT_GET_CLASS (document)->get_mime_type != NULL, NULL);
yelp-3.28.1/libyelp/yelp-document.c:1173:23: warning: Access to field 'index' results in a dereference of a null pointer (loaded from field 'g_class')
g_return_if_fail (YELP_DOCUMENT_GET_CLASS (document)->index != NULL);
---
libyelp/yelp-document.c | 56 ++++++++++++++++++++++++++++++-----------
1 file changed, 41 insertions(+), 15 deletions(-)
diff --git a/libyelp/yelp-document.c b/libyelp/yelp-document.c
index c1eec9cc..d832d1ed 100644
--- a/libyelp/yelp-document.c
+++ b/libyelp/yelp-document.c
@@ -815,17 +815,19 @@ yelp_document_request_page (YelpDocument *document,
gpointer user_data,
GDestroyNotify notify)
{
+ YelpDocumentClass *klass;
+
+ g_return_val_if_fail (document != NULL, FALSE);
g_return_val_if_fail (YELP_IS_DOCUMENT (document), FALSE);
- g_return_val_if_fail (YELP_DOCUMENT_GET_CLASS (document)->request_page != NULL, FALSE);
+
+ klass = YELP_DOCUMENT_GET_CLASS (document);
+ g_return_val_if_fail (klass != NULL, FALSE);
+ g_return_val_if_fail (klass->request_page != NULL, FALSE);
debug_print (DB_FUNCTION, "entering\n");
- return YELP_DOCUMENT_GET_CLASS (document)->request_page (document,
- page_id,
- cancellable,
- callback,
- user_data,
- notify);
+ return klass->request_page (document, page_id, cancellable, callback,
+ user_data, notify);
}
static gboolean
@@ -939,10 +941,16 @@ const gchar *
yelp_document_read_contents (YelpDocument *document,
const gchar *page_id)
{
+ YelpDocumentClass *klass;
+
+ g_return_val_if_fail (document != NULL, NULL);
g_return_val_if_fail (YELP_IS_DOCUMENT (document), NULL);
- g_return_val_if_fail (YELP_DOCUMENT_GET_CLASS (document)->read_contents != NULL, NULL);
- return YELP_DOCUMENT_GET_CLASS (document)->read_contents (document, page_id);
+ klass = YELP_DOCUMENT_GET_CLASS (document);
+ g_return_val_if_fail (klass != NULL, FALSE);
+ g_return_val_if_fail (klass->read_contents != NULL, FALSE);
+
+ return klass->read_contents (document, page_id);
}
static const gchar *
@@ -1096,10 +1104,16 @@ void
yelp_document_finish_read (YelpDocument *document,
const gchar *contents)
{
+ YelpDocumentClass *klass;
+
+ g_return_if_fail (document != NULL);
g_return_if_fail (YELP_IS_DOCUMENT (document));
- g_return_if_fail (YELP_DOCUMENT_GET_CLASS (document)->finish_read != NULL);
- YELP_DOCUMENT_GET_CLASS (document)->finish_read (document, contents);
+ klass = YELP_DOCUMENT_GET_CLASS (document);
+ g_return_if_fail (klass != NULL);
+ g_return_if_fail (klass->finish_read != NULL);
+
+ klass->finish_read (document, contents);
}
static void
@@ -1137,10 +1151,16 @@ gchar *
yelp_document_get_mime_type (YelpDocument *document,
const gchar *page_id)
{
+ YelpDocumentClass *klass;
+
+ g_return_val_if_fail (document != NULL, NULL);
g_return_val_if_fail (YELP_IS_DOCUMENT (document), NULL);
- g_return_val_if_fail (YELP_DOCUMENT_GET_CLASS (document)->get_mime_type != NULL, NULL);
- return YELP_DOCUMENT_GET_CLASS (document)->get_mime_type (document, page_id);
+ klass = YELP_DOCUMENT_GET_CLASS (document);
+ g_return_val_if_fail (klass != NULL, NULL);
+ g_return_val_if_fail (klass->get_mime_type != NULL, FALSE);
+
+ return klass->get_mime_type (document, page_id);
}
static gchar *
@@ -1169,10 +1189,16 @@ document_get_mime_type (YelpDocument *document,
void
yelp_document_index (YelpDocument *document)
{
+ YelpDocumentClass *klass;
+
+ g_return_if_fail (document != NULL);
g_return_if_fail (YELP_IS_DOCUMENT (document));
- g_return_if_fail (YELP_DOCUMENT_GET_CLASS (document)->index != NULL);
- YELP_DOCUMENT_GET_CLASS (document)->index (document);
+ klass = YELP_DOCUMENT_GET_CLASS (document);
+ g_return_if_fail (klass != NULL);
+ g_return_if_fail (klass->index != NULL);
+
+ klass->index (document);
}
static void
--
2.19.1

View File

@ -0,0 +1,36 @@
From 92974634d285448bbf2007a9bcfedf247a26a39b Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 10:55:52 +0200
Subject: [PATCH 05/17] Check whether variable node is set before dereferencing
it
yelp-3.28.1/libyelp/yelp-info-parser.c:766: dereference: Dereferencing a pointer that might be null "node" when calling "strncmp".
---
libyelp/yelp-info-parser.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libyelp/yelp-info-parser.c b/libyelp/yelp-info-parser.c
index d0e767bc..0c383bfe 100644
--- a/libyelp/yelp-info-parser.c
+++ b/libyelp/yelp-info-parser.c
@@ -734,7 +734,7 @@ process_page (GtkTreeStore *tree,
g_free (next);
next = NULL;
}
- if (g_str_equal (node, "Top") && prev != NULL) {
+ if (node && g_str_equal (node, "Top") && prev != NULL) {
g_free (prev);
prev = NULL;
}
@@ -763,7 +763,7 @@ process_page (GtkTreeStore *tree,
}
if (prev && g_ascii_strncasecmp (prev, "(dir)", 5))
{
- if (strncmp (node, "Top", 3)) {
+ if (node && strncmp (node, "Top", 3)) {
/* Special case the Top node to always appear first */
} else {
page = node2page (nodes2pages, prev);
--
2.19.1

View File

@ -0,0 +1,32 @@
From d7d1c089196e4e1bef314d6d6a01caffd6bba1da Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 10:57:33 +0200
Subject: [PATCH 06/17] Fix a use of an uninitialized variable
yelp-3.28.1/libyelp/yelp-info-parser.c:1174: var_decl: Declaring variable "menu_node" without initializer.
yelp-3.28.1/libyelp/yelp-info-parser.c:1310: uninit_use: Using uninitialized value "menu_node".
1308| else if (*(menuitems[i]) != '\0') {
1309| tmp = g_strconcat ("\n", first_non_space (menuitems[i]), NULL);
1310|-> xmlNewTextChild (mholder ? mholder : menu_node,
1311| NULL, BAD_CAST "para1",
1312| BAD_CAST tmp);
---
libyelp/yelp-info-parser.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libyelp/yelp-info-parser.c b/libyelp/yelp-info-parser.c
index 0c383bfe..ed16e373 100644
--- a/libyelp/yelp-info-parser.c
+++ b/libyelp/yelp-info-parser.c
@@ -1171,7 +1171,7 @@ yelp_info_parse_menu (GtkTreeStore *tree, xmlNodePtr *node,
gchar **split;
gchar **menuitems;
gchar *tmp = NULL;
- xmlNodePtr newnode, menu_node, mholder = NULL;
+ xmlNodePtr newnode, menu_node = NULL, mholder = NULL;
int i=0;
split = g_strsplit (page_content, "* Menu:", 2);
--
2.19.1

View File

@ -0,0 +1,29 @@
From 79e59e9d374e635ca65b4d24c59fffacc5425b1a Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 11:04:35 +0200
Subject: [PATCH 07/17] Check whether the index variable is valid before
dereferencing it
yelp-3.28.1/libyelp/yelp-mallard-document.c:1002: deref_ptr: Directly dereferencing pointer "index".
yelp-3.28.1/libyelp/yelp-mallard-document.c:1073: check_after_deref: Null-checking "index" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
---
libyelp/yelp-mallard-document.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libyelp/yelp-mallard-document.c b/libyelp/yelp-mallard-document.c
index 74fc80ee..9c006efc 100644
--- a/libyelp/yelp-mallard-document.c
+++ b/libyelp/yelp-mallard-document.c
@@ -1070,8 +1070,7 @@ mallard_index_threaded (YelpMallardDocument *mallard)
xmlXPathFreeContext (xpath);
if (index->doc != NULL)
xmlFreeDoc (index->doc);
- if (index != NULL)
- g_free (index);
+ g_free (index);
if (parserCtxt != NULL)
xmlFreeParserCtxt (parserCtxt);
g_object_unref (pagefile);
--
2.19.1

View File

@ -0,0 +1,35 @@
From 33bf987013a6f7c875dc643a74e11beba4a12f03 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 11:15:10 +0200
Subject: [PATCH 08/17] Check whether parser is null before dereferencing it
yelp-3.28.1/libyelp/yelp-man-parser.c:445: var_compare_op: Comparing "parser" to null implies that "parser" might be null.
yelp-3.28.1/libyelp/yelp-man-parser.c:449: var_deref_op: Dereferencing null pointer "parser".
---
libyelp/yelp-man-parser.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libyelp/yelp-man-parser.c b/libyelp/yelp-man-parser.c
index 46073a2e..8d097820 100644
--- a/libyelp/yelp-man-parser.c
+++ b/libyelp/yelp-man-parser.c
@@ -442,10 +442,12 @@ void
yelp_man_parser_free (YelpManParser *parser)
{
guint k;
- if (parser) {
- for (k=0; k<MAN_FONTS; k++)
- g_free (parser->font_registers[k]);
- }
+
+ if (parser == NULL)
+ return;
+
+ for (k=0; k<MAN_FONTS; k++)
+ g_free (parser->font_registers[k]);
g_string_free (parser->accumulator, TRUE);
g_free (parser->title_str);
g_free (parser->section);
--
2.19.1

View File

@ -0,0 +1,40 @@
From b1d8fce69f59581769e5db87e7e20cdc3c27d685 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 11:30:54 +0200
Subject: [PATCH 09/17] Avoid possible overrun while comparing to MAN_FONTS
yelp-3.28.1/libyelp/yelp-man-parser.c:464: cond_at_most: Checking "k > 8U" implies that "k" may be up to 8 on the false branch.
yelp-3.28.1/libyelp/yelp-man-parser.c:469: overrun-local: Overrunning array "parser->font_registers" of 8 8-byte elements at element index 8 (byte offset 64) using index "k" (which evaluates to 8).
yelp-3.28.1/libyelp/yelp-man-parser.c:476: assignment: Assigning: "k" = "parser->current_font".
yelp-3.28.1/libyelp/yelp-man-parser.c:477: cond_at_most: Checking "k > 8U" implies that "k" and "parser->current_font" may be up to 8 on the false branch.
yelp-3.28.1/libyelp/yelp-man-parser.c:477: overrun-local: Overrunning array "parser->font_registers" of 8 8-byte elements at element index 8 (byte offset 64) using index "k" (which evaluates to 8).
---
libyelp/yelp-man-parser.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libyelp/yelp-man-parser.c b/libyelp/yelp-man-parser.c
index 8d097820..00e66e00 100644
--- a/libyelp/yelp-man-parser.c
+++ b/libyelp/yelp-man-parser.c
@@ -463,7 +463,7 @@ yelp_man_parser_free (YelpManParser *parser)
static void
set_font_register (YelpManParser *parser, guint k, const gchar* name)
{
- if (k > MAN_FONTS) {
+ if (k >= MAN_FONTS) {
g_warning ("Tried to set nonexistant font register %u to %s",
k, name);
return;
@@ -476,7 +476,7 @@ static const gchar*
get_font (const YelpManParser *parser)
{
guint k = parser->current_font;
- if (k > MAN_FONTS ||
+ if (k >= MAN_FONTS ||
parser->font_registers[k] == NULL) {
g_warning ("Tried to get nonexistant font register %u", k);
--
2.19.1

View File

@ -0,0 +1,37 @@
From 526febe57f9c05e3ca8a08e4016c5b36b8195406 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 11:43:51 +0200
Subject: [PATCH 10/17] Increase the size of string variables passed to sscanf
yelp-3.28.1/libyelp/yelp-man-parser.c:549: error[invalidScanfFormatWidth]: Width 10 given in format string (no. 2) is larger than destination buffer 'name[10]', use %9s to prevent overflowing it.
yelp-3.28.1/libyelp/yelp-man-parser.c:926: error[invalidScanfFormatWidth]: Width 16 given in format string (no. 1) is larger than destination buffer 'name[16]', use %15s to prevent overflowing it.
---
libyelp/yelp-man-parser.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libyelp/yelp-man-parser.c b/libyelp/yelp-man-parser.c
index 00e66e00..f8eb69f6 100644
--- a/libyelp/yelp-man-parser.c
+++ b/libyelp/yelp-man-parser.c
@@ -545,7 +545,7 @@ parse_prologue_line (YelpManParser *parser, GError **error)
static gboolean
parse_xf (YelpManParser *parser, GError **error)
{
- gchar name[10];
+ gchar name[11];
guint k;
if (SSCANF ("x f%*s %u %10s", 2, &k, name)) {
@@ -920,7 +920,7 @@ append_nbsps (YelpManParser *parser, guint k)
static gboolean
parse_C (YelpManParser *parser, GError **error)
{
- gchar name[16];
+ gchar name[17];
gunichar code = 0;
guint k;
gint len;
--
2.19.1

View File

@ -0,0 +1,27 @@
From c5abcf98fdbb437574f916b6b2c1fa2f3a89219f Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 11:45:36 +0200
Subject: [PATCH 11/17] Initialize ws_start variable before returning it
yelp-3.28.1/libyelp/yelp-man-parser.c:1194: var_decl: Declaring variable "ws_start" without initializer.
yelp-3.28.1/libyelp/yelp-man-parser.c:1202: uninit_use: Using uninitialized value "ws_start".
---
libyelp/yelp-man-parser.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libyelp/yelp-man-parser.c b/libyelp/yelp-man-parser.c
index f8eb69f6..302ccb31 100644
--- a/libyelp/yelp-man-parser.c
+++ b/libyelp/yelp-man-parser.c
@@ -1193,7 +1193,7 @@ static gchar *
find_contiguous_whitespace (gchar *text, guint ws_len)
{
guint counter = 0;
- gchar *ws_start;
+ gchar *ws_start = NULL;
while (*text) {
if (g_unichar_isspace (g_utf8_get_char (text))) {
if (!counter) ws_start = text;
--
2.19.1

View File

@ -0,0 +1,32 @@
From 3fe0efe361ca9fb697f82d67e0bd9036970f9884 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 11:53:13 +0200
Subject: [PATCH 12/17] Swap the if() checks to avoid possible null pointer
dereference
yelp-3.28.1/libyelp/yelp-transform.c:501: deref_ptr: Directly dereferencing pointer "ctxt".
yelp-3.28.1/libyelp/yelp-transform.c:504: check_after_deref: Null-checking "ctxt" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
---
libyelp/yelp-transform.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libyelp/yelp-transform.c b/libyelp/yelp-transform.c
index 7a5dc86e..0a1c8058 100644
--- a/libyelp/yelp-transform.c
+++ b/libyelp/yelp-transform.c
@@ -498,10 +498,10 @@ xslt_yelp_document (xsltTransformContextPtr ctxt,
debug_print (DB_FUNCTION, "entering\n");
- if (ctxt->state == XSLT_STATE_STOPPED)
+ if (!ctxt || !node || !inst || !comp)
return;
- if (!ctxt || !node || !inst || !comp)
+ if (ctxt->state == XSLT_STATE_STOPPED)
return;
transform = YELP_TRANSFORM (ctxt->_private);
--
2.19.1

View File

@ -0,0 +1,33 @@
From e3e9e7961b721d2bdbf50ca81fdc869170289e28 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Mon, 23 Jul 2018 11:56:21 +0200
Subject: [PATCH 13/17] Check the strstr() return value before using it
yelp-3.28.1/libyelp/yelp-uri-builder.c:81: returned_null: "strstr" returns null (checked 10 out of 12 times).
yelp-3.28.1/libyelp/yelp-uri-builder.c:81: var_assigned: Assigning: "resource" = null return value from "strstr".
yelp-3.28.1/libyelp/yelp-uri-builder.c:82: dereference: Incrementing a pointer which might be null: "resource".
---
libyelp/yelp-uri-builder.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libyelp/yelp-uri-builder.c b/libyelp/yelp-uri-builder.c
index bb34d202..58a53ac9 100644
--- a/libyelp/yelp-uri-builder.c
+++ b/libyelp/yelp-uri-builder.c
@@ -78,9 +78,10 @@ build_yelp_uri (const gchar *uri_str)
memmove (uri, uri + BOGUS_PREFIX_LEN, strlen (uri) - BOGUS_PREFIX_LEN + 1);
/* Remove the leading slash */
- resource = strstr (uri, ":");
- resource++;
- memmove (resource, resource + 1, strlen (resource));
+ if ((resource = strstr (uri, ":"))) {
+ resource++;
+ memmove (resource, resource + 1, strlen (resource));
+ }
/* Remove the trailing slash if any */
path_len = strlen (uri);
--
2.19.1

View File

@ -0,0 +1,27 @@
From 16bcefc7eeca2443e79b85e5257f66ef5b50eaf0 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Tue, 24 Jul 2018 12:45:42 +0200
Subject: [PATCH 14/17] Check variable before dereferencing it
yelp-3.28.1/libyelp/yelp-mallard-document.c:341: var_compare_op: Comparing "path" to null implies that "path" might be null.
yelp-3.28.1/libyelp/yelp-mallard-document.c:346: var_deref_op: Dereferencing null pointer "path".
---
libyelp/yelp-mallard-document.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libyelp/yelp-mallard-document.c b/libyelp/yelp-mallard-document.c
index 9c006efc..b3319310 100644
--- a/libyelp/yelp-mallard-document.c
+++ b/libyelp/yelp-mallard-document.c
@@ -345,7 +345,7 @@ mallard_think (YelpMallardDocument *mallard)
*/
error = g_error_new (YELP_ERROR, YELP_ERROR_NOT_FOUND,
_("The directory %s does not exist."),
- path[0]);
+ path && path[0] ? path[0] : "NULL");
yelp_document_error_pending ((YelpDocument *) mallard, error);
g_error_free (error);
goto done;
--
2.19.1

View File

@ -0,0 +1,32 @@
From a49c3d4b94dbfabefe81d2c6d903c53c252bf78a Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Fri, 12 Oct 2018 11:04:31 +0200
Subject: [PATCH 15/17] Remove unused variable
4. yelp-3.28.1/libyelp/yelp-info-parser.c:959:2: note: Value stored to 'pages' is never read
pages = 0;
^ ~
957| (GDestroyNotify) gtk_tree_iter_free);
958|
959|-> pages = 0;
960| for (ptr = page_list; *ptr != NULL; ptr++)
961| {
---
libyelp/yelp-info-parser.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libyelp/yelp-info-parser.c b/libyelp/yelp-info-parser.c
index ed16e373..7b718ea0 100644
--- a/libyelp/yelp-info-parser.c
+++ b/libyelp/yelp-info-parser.c
@@ -956,7 +956,6 @@ GtkTreeStore
nodes2iters = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
(GDestroyNotify) gtk_tree_iter_free);
- pages = 0;
for (ptr = page_list; *ptr != NULL; ptr++)
{
if (page_type (*ptr) != PAGE_NODE) continue;
--
2.19.1

View File

@ -0,0 +1,225 @@
From 7076be534597dadba5c3b3bcfdd10a93333fbc43 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Fri, 12 Oct 2018 12:11:32 +0200
Subject: [PATCH 16/17] Fix possible double free
Error: CLANG_WARNING:
yelp-3.28.1/libyelp/yelp-uri.c:931:5: warning: Attempt to free released memory
g_free (query);
^
yelp-3.28.1/libyelp/yelp-uri.c:259:9: note: Assuming the condition is false
if (priv->doctype != YELP_URI_DOCUMENT_TYPE_UNRESOLVED)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:259:5: note: Taking false branch
if (priv->doctype != YELP_URI_DOCUMENT_TYPE_UNRESOLVED)
^
yelp-3.28.1/libyelp/yelp-uri.c:262:9: note: Assuming the condition is false
if (priv->res_base)
^~~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:262:5: note: Taking false branch
if (priv->res_base)
^
yelp-3.28.1/libyelp/yelp-uri.c:266:5: note: Calling 'resolve_sync'
resolve_sync (uri);
^~~~~~~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:311:9: note: Assuming the condition is false
if (g_str_has_prefix (priv->res_arg, "ghelp:")
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:311:9: note: Left side of '||' is false
yelp-3.28.1/libyelp/yelp-uri.c:312:12: note: Assuming the condition is false
|| g_str_has_prefix (priv->res_arg, "gnome-help:")) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:311:5: note: Taking false branch
if (g_str_has_prefix (priv->res_arg, "ghelp:")
^
yelp-3.28.1/libyelp/yelp-uri.c:315:14: note: Assuming the condition is true
else if (g_str_has_prefix (priv->res_arg, "help:")) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:315:10: note: Taking true branch
else if (g_str_has_prefix (priv->res_arg, "help:")) {
^
yelp-3.28.1/libyelp/yelp-uri.c:316:9: note: Calling 'resolve_help_uri'
resolve_help_uri (uri);
^~~~~~~~~~~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:856:9: note: Assuming 'colon' is non-null
if (!colon) {
^~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:856:5: note: Taking false branch
if (!colon) {
^
yelp-3.28.1/libyelp/yelp-uri.c:862:21: note: Assuming the condition is true
for (c = colon; *c != '\0'; c++) {
^~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:862:5: note: Loop condition is true. Entering loop body
for (c = colon; *c != '\0'; c++) {
^
yelp-3.28.1/libyelp/yelp-uri.c:863:13: note: Assuming the condition is false
if (*c == '#' && hash == NULL)
^~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:863:23: note: Left side of '&&' is false
if (*c == '#' && hash == NULL)
^
yelp-3.28.1/libyelp/yelp-uri.c:865:18: note: Assuming the condition is false
else if (*c == '?' && query == NULL && hash == NULL)
^~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:865:28: note: Left side of '&&' is false
else if (*c == '?' && query == NULL && hash == NULL)
^
yelp-3.28.1/libyelp/yelp-uri.c:867:18: note: Assuming the condition is false
else if (*c == '/' && slash == NULL && query == NULL && hash == NULL)
^~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:867:28: note: Left side of '&&' is false
else if (*c == '/' && slash == NULL && query == NULL && hash == NULL)
^
yelp-3.28.1/libyelp/yelp-uri.c:862:21: note: Assuming the condition is true
for (c = colon; *c != '\0'; c++) {
^~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:862:5: note: Loop condition is true. Entering loop body
for (c = colon; *c != '\0'; c++) {
^
yelp-3.28.1/libyelp/yelp-uri.c:863:13: note: Assuming the condition is false
if (*c == '#' && hash == NULL)
^~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:863:23: note: Left side of '&&' is false
if (*c == '#' && hash == NULL)
^
yelp-3.28.1/libyelp/yelp-uri.c:865:18: note: Assuming the condition is true
else if (*c == '?' && query == NULL && hash == NULL)
^~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:865:18: note: Left side of '&&' is true
yelp-3.28.1/libyelp/yelp-uri.c:865:18: note: Left side of '&&' is true
yelp-3.28.1/libyelp/yelp-uri.c:865:14: note: Taking true branch
else if (*c == '?' && query == NULL && hash == NULL)
^
yelp-3.28.1/libyelp/yelp-uri.c:862:21: note: Assuming the condition is true
for (c = colon; *c != '\0'; c++) {
^~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:862:5: note: Loop condition is true. Entering loop body
for (c = colon; *c != '\0'; c++) {
^
yelp-3.28.1/libyelp/yelp-uri.c:863:13: note: Assuming the condition is true
if (*c == '#' && hash == NULL)
^~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:863:13: note: Left side of '&&' is true
yelp-3.28.1/libyelp/yelp-uri.c:863:9: note: Taking true branch
if (*c == '#' && hash == NULL)
^
yelp-3.28.1/libyelp/yelp-uri.c:862:21: note: Assuming the condition is false
for (c = colon; *c != '\0'; c++) {
^~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:862:5: note: Loop condition is false. Execution continues on line 871
for (c = colon; *c != '\0'; c++) {
^
yelp-3.28.1/libyelp/yelp-uri.c:871:9: note: Left side of '||' is false
if (slash || query || hash)
^
yelp-3.28.1/libyelp/yelp-uri.c:871:24: note: Left side of '||' is true
if (slash || query || hash)
^
yelp-3.28.1/libyelp/yelp-uri.c:873:32: note: '?' condition is false
(slash ? slash : (query ? query : hash)) - colon - 1);
^
yelp-3.28.1/libyelp/yelp-uri.c:873:49: note: '?' condition is true
(slash ? slash : (query ? query : hash)) - colon - 1);
^
yelp-3.28.1/libyelp/yelp-uri.c:877:15: note: Left side of '&&' is false
if (slash && (query || hash))
^
yelp-3.28.1/libyelp/yelp-uri.c:880:10: note: Taking false branch
else if (slash)
^
yelp-3.28.1/libyelp/yelp-uri.c:883:9: note: Assuming 'query' is null
if (query && hash)
^~~~~
yelp-3.28.1/libyelp/yelp-uri.c:883:15: note: Left side of '&&' is false
if (query && hash)
^
yelp-3.28.1/libyelp/yelp-uri.c:886:14: note: Assuming 'query' is null
else if (query)
^~~~~
yelp-3.28.1/libyelp/yelp-uri.c:886:10: note: Taking false branch
else if (query)
^
yelp-3.28.1/libyelp/yelp-uri.c:889:9: note: Assuming 'query' is null
if (query) {
^~~~~
yelp-3.28.1/libyelp/yelp-uri.c:889:5: note: Taking false branch
if (query) {
^
yelp-3.28.1/libyelp/yelp-uri.c:907:9: note: Assuming 'hash' is null
if (hash)
^~~~
yelp-3.28.1/libyelp/yelp-uri.c:907:5: note: Taking false branch
if (hash)
^
yelp-3.28.1/libyelp/yelp-uri.c:910:22: note: '?' condition is false
priv->page_id = (slash ? slash : g_strdup ("index"));
^
yelp-3.28.1/libyelp/yelp-uri.c:913:9: note: Assuming 'hash' is non-null
if (hash)
^~~~
yelp-3.28.1/libyelp/yelp-uri.c:913:5: note: Taking true branch
if (hash)
^
yelp-3.28.1/libyelp/yelp-uri.c:915:9: note: Assuming the condition is true
if (priv->frag_id && g_str_has_prefix (priv->frag_id, "search=")) {
^~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:915:9: note: Left side of '&&' is true
yelp-3.28.1/libyelp/yelp-uri.c:915:26: note: Assuming the condition is true
if (priv->frag_id && g_str_has_prefix (priv->frag_id, "search=")) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:915:5: note: Taking true branch
if (priv->frag_id && g_str_has_prefix (priv->frag_id, "search=")) {
^
yelp-3.28.1/libyelp/yelp-uri.c:916:9: note: Memory is released
g_free (priv->frag_id);
^~~~~~~~~~~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:923:34: note: Assuming the condition is false
priv->page_id ? "/" : "",
^~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-uri.c:923:34: note: '?' condition is false
yelp-3.28.1/libyelp/yelp-uri.c:924:34: note: '?' condition is false
priv->page_id ? priv->page_id : "",
^
yelp-3.28.1/libyelp/yelp-uri.c:925:34: note: Assuming 'query' is non-null
query ? "?" : "",
^~~~~
yelp-3.28.1/libyelp/yelp-uri.c:925:34: note: '?' condition is true
yelp-3.28.1/libyelp/yelp-uri.c:926:34: note: '?' condition is true
query ? query : "",
^
yelp-3.28.1/libyelp/yelp-uri.c:927:34: note: '?' condition is false
priv->frag_id ? "#" : "",
^
yelp-3.28.1/libyelp/yelp-uri.c:928:34: note: '?' condition is false
priv->frag_id ? priv->frag_id : "",
^
yelp-3.28.1/libyelp/yelp-uri.c:931:5: note: Attempt to free released memory
g_free (query);
^~~~~~~~~~~~~~
929| NULL);
930|
931|-> g_free (query);
932| g_free (document);
933| return;
---
libyelp/yelp-uri.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libyelp/yelp-uri.c b/libyelp/yelp-uri.c
index f20b167e..385cb837 100644
--- a/libyelp/yelp-uri.c
+++ b/libyelp/yelp-uri.c
@@ -928,7 +928,8 @@ resolve_help_uri (YelpUri *uri)
priv->frag_id ? priv->frag_id : "",
NULL);
- g_free (query);
+ if (query)
+ g_free (query);
g_free (document);
return;
}
--
2.19.1

View File

@ -0,0 +1,147 @@
From 2b2fde7b980985c45ddbd77c935ce43350006810 Mon Sep 17 00:00:00 2001
From: Tomas Popela <tpopela@redhat.com>
Date: Fri, 12 Oct 2018 12:53:43 +0200
Subject: [PATCH 17/17] Remove the unused encoding and language code from
YelpManDocument
Error: UNUSED_VALUE (CWE-563): [#def25]
yelp-3.28.1/libyelp/yelp-man-document.c:422: value_overwrite: Overwriting previous write to "encoding" with value from "langmap[i].encoding".
yelp-3.28.1/libyelp/yelp-man-document.c:416: assigned_pointer: Assigning value from ""ISO-8859-1"" to "encoding" here, but that stored value is overwritten before it can be used.
414| encoding = g_getenv("MAN_ENCODING");
415| if (encoding == NULL)
416|-> encoding = "ISO-8859-1";
417|
418| if (language != NULL) {
Error: CLANG_WARNING: [#def26]
yelp-3.28.1/libyelp/yelp-man-document.c:416:2: warning: Value stored to 'encoding' is never read
encoding = "ISO-8859-1";
^ ~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-man-document.c:416:2: note: Value stored to 'encoding' is never read
encoding = "ISO-8859-1";
^ ~~~~~~~~~~~~
414| encoding = g_getenv("MAN_ENCODING");
415| if (encoding == NULL)
416|-> encoding = "ISO-8859-1";
417|
418| if (language != NULL) {
Error: CLANG_WARNING: [#def27]
yelp-3.28.1/libyelp/yelp-man-document.c:422:3: warning: Value stored to 'encoding' is never read
encoding = langmap[i].encoding;
^ ~~~~~~~~~~~~~~~~~~~
yelp-3.28.1/libyelp/yelp-man-document.c:422:3: note: Value stored to 'encoding' is never read
encoding = langmap[i].encoding;
^ ~~~~~~~~~~~~~~~~~~~
420| for (i = 0; langmap[i].language != NULL; i++) {
421| if (g_str_equal (language, langmap[i].language)) {
422|-> encoding = langmap[i].encoding;
423| break;
424| }
---
libyelp/yelp-man-document.c | 75 -------------------------------------
1 file changed, 75 deletions(-)
diff --git a/libyelp/yelp-man-document.c b/libyelp/yelp-man-document.c
index ad7fab4f..a18248ca 100644
--- a/libyelp/yelp-man-document.c
+++ b/libyelp/yelp-man-document.c
@@ -61,62 +61,6 @@ struct _YelpManDocumentPrivate {
guint error;
};
-typedef struct _YelpLangEncodings YelpLangEncodings;
-struct _YelpLangEncodings {
- const gchar *language;
- const gchar *encoding;
-};
-/* http://www.w3.org/International/O-charset-lang.html */
-static const YelpLangEncodings langmap[] = {
- { "C", "ISO-8859-1" },
- { "af", "ISO-8859-1" },
- { "ar", "ISO-8859-6" },
- { "bg", "ISO-8859-5" },
- { "be", "ISO-8859-5" },
- { "ca", "ISO-8859-1" },
- { "cs", "ISO-8859-2" },
- { "da", "ISO-8859-1" },
- { "de", "ISO-8859-1" },
- { "el", "ISO-8859-7" },
- { "en", "ISO-8859-1" },
- { "eo", "ISO-8859-3" },
- { "es", "ISO-8859-1" },
- { "et", "ISO-8859-15" },
- { "eu", "ISO-8859-1" },
- { "fi", "ISO-8859-1" },
- { "fo", "ISO-8859-1" },
- { "fr", "ISO-8859-1" },
- { "ga", "ISO-8859-1" },
- { "gd", "ISO-8859-1" },
- { "gl", "ISO-8859-1" },
- { "hu", "ISO-8859-2" },
- { "id", "ISO-8859-1" }, /* is this right */
- { "mt", "ISO-8859-3" },
- { "is", "ISO-8859-1" },
- { "it", "ISO-8859-1" },
- { "iw", "ISO-8859-8" },
- { "ja", "EUC-JP" },
- { "ko", "EUC-KR" },
- { "lt", "ISO-8859-13" },
- { "lv", "ISO-8859-13" },
- { "mk", "ISO-8859-5" },
- { "mt", "ISO-8859-3" },
- { "no", "ISO-8859-1" },
- { "pl", "ISO-8859-2" },
- { "pt_BR", "ISO-8859-1" },
- { "ro", "ISO-8859-2" },
- { "ru", "KOI8-R" },
- { "sl", "ISO-8859-2" },
- { "sr", "ISO-8859-2" }, /* Latin, not cyrillic */
- { "sk", "ISO-8859-2" },
- { "sv", "ISO-8859-1" },
- { "tr", "ISO-8859-9" },
- { "uk", "ISO-8859-5" },
- { "zh_CN", "BIG5" },
- { "zh_TW", "BIG5" },
- { NULL, NULL },
-};
-
static void yelp_man_document_finalize (GObject *object);
/* YelpDocument */
@@ -385,7 +329,6 @@ man_document_process (YelpManDocument *man)
gint params_i = 0;
gchar **params = NULL;
YelpManParser *parser;
- const gchar *language, *encoding;
file = yelp_uri_get_file (yelp_document_get_uri ((YelpDocument *) man));
if (file == NULL) {
@@ -407,24 +350,6 @@ man_document_process (YelpManDocument *man)
goto done;
}
- /* FIXME: get the language */
- language = "C";
-
- /* default encoding if the language doesn't match below */
- encoding = g_getenv("MAN_ENCODING");
- if (encoding == NULL)
- encoding = "ISO-8859-1";
-
- if (language != NULL) {
- gint i;
- for (i = 0; langmap[i].language != NULL; i++) {
- if (g_str_equal (language, langmap[i].language)) {
- encoding = langmap[i].encoding;
- break;
- }
- }
- }
-
parser = yelp_man_parser_new ();
priv->xmldoc = yelp_man_parser_parse_file (parser, filepath, &error);
yelp_man_parser_free (parser);
--
2.19.1

83
SOURCES/yelp-quit.patch Normal file
View File

@ -0,0 +1,83 @@
diff --git a/src/yelp-application.c b/src/yelp-application.c
index 47a69991..28638ee7 100644
--- a/src/yelp-application.c
+++ b/src/yelp-application.c
@@ -90,6 +90,9 @@ static void application_adjust_font (GAction *a
GVariant *parameter,
YelpApplication *app);
static void application_set_font_sensitivity (YelpApplication *app);
+static void application_quit (GAction *action,
+ GVariant *parameter,
+ YelpApplication *app);
static void bookmarks_changed (GSettings *settings,
const gchar *key,
@@ -110,6 +113,7 @@ struct _YelpApplicationPrivate {
GPropertyAction *show_cursor_action;
GSimpleAction *larger_text_action;
GSimpleAction *smaller_text_action;
+ GSimpleAction *quit_action;
GSettingsBackend *backend;
GSettings *gsettings;
@@ -200,6 +204,11 @@ yelp_application_dispose (GObject *object)
priv->larger_text_action = NULL;
}
+ if (priv->quit_action) {
+ g_object_unref (priv->quit_action);
+ priv->quit_action = NULL;
+ }
+
if (priv->smaller_text_action) {
g_object_unref (priv->smaller_text_action);
priv->smaller_text_action = NULL;
@@ -267,6 +276,7 @@ yelp_application_startup (GApplication *application)
GMenu *menu, *section;
gchar *keyfile;
YelpSettings *settings;
+ const gchar *quit_accels[2] = { "<Ctrl>Q", NULL };
g_set_application_name (N_("Help"));
@@ -316,6 +326,16 @@ yelp_application_startup (GApplication *application)
application_set_font_sensitivity (app);
+ priv->quit_action = g_simple_action_new ("yelp-application-quit", NULL);
+ g_signal_connect (priv->quit_action,
+ "activate",
+ G_CALLBACK (application_quit),
+ app);
+ g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (priv->quit_action));
+
+ gtk_application_set_accels_for_action (
+ GTK_APPLICATION (app), "app.yelp-application-quit", quit_accels);
+
menu = g_menu_new ();
section = g_menu_new ();
g_menu_append (section, _("New Window"), "win.yelp-window-new");
@@ -326,11 +346,23 @@ yelp_application_startup (GApplication *application)
g_menu_append (section, _("Smaller Text"), "app.yelp-application-smaller-text");
g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
g_object_unref (section);
+ section = g_menu_new ();
+ g_menu_append (section, _("Quit"), "app.yelp-application-quit");
+ g_menu_append_section (menu, NULL, G_MENU_MODEL (section));
+ g_object_unref (section);
gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (menu));
}
/******************************************************************************/
+static void
+application_quit (GAction *action,
+ GVariant *parameter,
+ YelpApplication *app)
+{
+ g_application_quit (G_APPLICATION (app));
+}
+
static void
application_adjust_font (GAction *action,
GVariant *parameter,

1055
SPECS/yelp.spec Normal file

File diff suppressed because it is too large Load Diff