commit | 6189d95036f123d48d505bf4d4a49ba11ca30aee | [log] [tgz] |
---|---|---|
author | Stefan Esser <se@freebsd.org> | Sat Apr 27 10:40:14 2019 +0200 |
committer | Stefan Esser <se@freebsd.org> | Sat Apr 27 10:40:14 2019 +0200 |
tree | 1101b008087d661d8632f9e9a994fe9cf136c0db | |
parent | 70f118574077b6e61cae08bd576ca7fccc167786 [diff] [blame] |
Fix segmentation fault that occurs if the target rdx is lower than the current rdx
diff --git a/src/num.c b/src/num.c index 23e8adf..da8e074 100644 --- a/src/num.c +++ b/src/num.c
@@ -427,7 +427,7 @@ } else if (BC_NUM_NONZERO(n)) { - if (places_rdx != n->rdx) { + if (places_rdx > n->rdx) { bc_num_expand(n, n->len + places_rdx - n->rdx + shift); memmove(n->num + places_rdx - n->rdx, n->num, BC_NUM_SIZE(n->len)); memset(n->num, 0, BC_NUM_SIZE(places_rdx - n->rdx));