diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-01-23 20:48:56 +0000 |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-01-23 20:48:56 +0000 |
commit | fc5290458d00e3eebf82dd914fd2848b7e3f7e87 (patch) | |
tree | 4b960a76bfe820cb5f9302afb3f37c2398c7fd09 /Python | |
parent | c64614e0437d1c78f36d8690bd4955603f460e0a (diff) | |
download | cpython-git-fc5290458d00e3eebf82dd914fd2848b7e3f7e87.tar.gz |
Issue #7743: Add checks for zero inputs to the lshift and mult functions;
this fixes the first bug described in issue #7743.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/dtoa.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Python/dtoa.c b/Python/dtoa.c index 6e11b9a757..6a93aef3bd 100644 --- a/Python/dtoa.c +++ b/Python/dtoa.c @@ -622,6 +622,15 @@ mult(Bigint *a, Bigint *b) ULong z2; #endif + if ((!a->x[0] && a->wds == 1) || (!b->x[0] && b->wds == 1)) { + c = Balloc(0); + if (c == NULL) + return NULL; + c->wds = 1; + c->x[0] = 0; + return c; + } + if (a->wds < b->wds) { c = a; a = b; @@ -820,6 +829,9 @@ lshift(Bigint *b, int k) Bigint *b1; ULong *x, *x1, *xe, z; + if (!k || (!b->x[0] && b->wds == 1)) + return b; + n = k >> 5; k1 = b->k; n1 = n + b->wds + 1; |