util-linux/backport-lib-strutils-fix-floating-point-exception.patch
yang_zhuang_zhuang 47ec069fb2 Fix memleak in fdisk_script_read_file
Fix heap-buffer-overflow in fdisk_partname
Fix integer overflow in partno_from_devname
2021-03-01 19:09:35 +08:00

25 lines
762 B
Diff

From 1186cdf336e9d29089de54ff59dba6d2ee1bd803 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 28 Apr 2020 12:28:59 +0200
Subject: [PATCH] lib/strutils: fix floating point exception
Addresses: https://github.com/karelzak/util-linux/issues/1017
Signed-off-by: Karel Zak <kzak@redhat.com>
---
lib/strutils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/strutils.c b/lib/strutils.c
index e1629fb56..609ef0860 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -195,7 +195,7 @@ int parse_size(const char *str, uintmax_t *res, int *power)
frac /= 10; /* remove last digit from frac */
frac_poz *= 10;
- if (seg)
+ if (seg && seg_div / seg)
x += frac_base / (seg_div / seg);
} while (frac);
}