summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-11-09 20:09:49 +0000
committerRichard Hughes <richard@hughsie.com>2016-11-09 20:09:49 +0000
commit5cb72104199cf7745afdb1e5fd941d9072a867d8 (patch)
treec8c8f3166e85553b7987f9f0c125b349b54a2456
parent19e40190d114255fbb4a977a6eb00d3716904ceb (diff)
downloadcolord-5cb72104199cf7745afdb1e5fd941d9072a867d8.tar.gz
Fix possible division by zero if parsing /proc/cpuinfo fails
Found using Coverity.
-rw-r--r--lib/colord/cd-transform.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/colord/cd-transform.c b/lib/colord/cd-transform.c
index 0208627..b09bb76 100644
--- a/lib/colord/cd-transform.c
+++ b/lib/colord/cd-transform.c
@@ -630,6 +630,7 @@ cd_transform_set_max_threads_default (CdTransform *transform, GError **error)
}
priv->max_threads = g_ascii_strtoull (tmp + 12, NULL, 10);
if (priv->max_threads == 0) {
+ priv->max_threads = 1;
g_set_error_literal (error,
CD_TRANSFORM_ERROR,
CD_TRANSFORM_ERROR_LAST,
@@ -683,6 +684,7 @@ cd_transform_process (CdTransform *transform,
g_return_val_if_fail (width != 0, FALSE);
g_return_val_if_fail (height != 0, FALSE);
g_return_val_if_fail (rowstride != 0, FALSE);
+ g_return_val_if_fail (priv->max_threads != 0, FALSE);
/* check stuff that should have been set */
if (priv->rendering_intent == CD_RENDERING_INTENT_UNKNOWN) {