diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-11-17 15:30:32 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2016-11-17 15:30:32 (GMT) |
| commit | 1be35f340f98dc2d8ff29d5d5c1fc4709f424fc8 (patch) | |
| tree | 1f924b02e7e59fb0689e28bedd2d654a3f77cc02 /generic/tclObj.c | |
| parent | ca471eb7483c0847ccdd54d653511fd06ebef7df (diff) | |
| download | tcl-1be35f340f98dc2d8ff29d5d5c1fc4709f424fc8.zip tcl-1be35f340f98dc2d8ff29d5d5c1fc4709f424fc8.tar.gz tcl-1be35f340f98dc2d8ff29d5d5c1fc4709f424fc8.tar.bz2 | |
Restore bn_mp_radix_size.c to exact copy of libtommath-1.0 version: Since the radix_size of "9" should return 2, not 3. Add test-case to prove that.
Diffstat (limited to 'generic/tclObj.c')
| -rw-r--r-- | generic/tclObj.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c index d3f59ec..6c850af 100644 --- a/generic/tclObj.c +++ b/generic/tclObj.c @@ -3252,13 +3252,11 @@ UpdateStringOfBignum( if (status != MP_OKAY) { Tcl_Panic("radix size failure in UpdateStringOfBignum"); } - if (size == 3) { + if (size < 2) { /* - * mp_radix_size() returns 3 when more than INT_MAX bytes would be + * mp_radix_size() returns < 2 when more than INT_MAX bytes would be * needed to hold the string rep (because mp_radix_size ignores - * integer overflow issues). When we know the string rep will be more - * than 3, we can conclude the string rep would overflow our string - * length limits. + * integer overflow issues). * * Note that so long as we enforce our bignums to the size that fits * in a packed bignum, this branch will never be taken. |
