diff options
author | Pádraig Brady <P@draigBrady.com> | 2012-10-08 15:48:43 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2012-10-09 00:07:35 +0100 |
commit | 024a1d572c01db2e12a86cd893d98518c73e51d1 (patch) | |
tree | 815f2cc8d0258270310241ddcb43c1bf8198a98b /tests/rmdir/fail-perm.sh | |
parent | cf9cd8958bbf294c30b82c2d5e9ea64ef14f37b9 (diff) | |
download | coreutils-024a1d572c01db2e12a86cd893d98518c73e51d1.tar.xz |
factor: fix integer validation and GMP fallback
In the recent factor rewrite, the GMP code
wasn't actually used; just an error was printed
on integer overflow. While fixing that it was noticed
that correct input validation wasn't done in all cases
when falling back to the GMP code.
* src/factor.c (print_factors) Fallback to GMP on overflow.
(strto2uintmax): Scan the string for invalid characters,
so that case can be detected independently of overflow.
Return an error when an empty string is passed.
Also allow leading spaces and '+' in input numbers.
* tests/misc/factor.pl: Ensure the GMP code is exercised
when compiled in. Also add a test to verify leading
spaces and '+' are allowed.
Diffstat (limited to 'tests/rmdir/fail-perm.sh')
0 files changed, 0 insertions, 0 deletions