ash: make ${v:N:M} more robust for very large M by clamping to MIN/MAX_INT
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 10 Jan 2018 12:22:25 +0000 (13:22 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 10 Jan 2018 12:22:25 +0000 (13:22 +0100)
commitbaa41c785551ae0580526298aa6fadf4534fc8c0
treefd23926ca1e7d7f2be2b2b4e2dd24fb32a7e8501
parent2c876774a90ddb7478937ead096937f64e6bd7ec
ash: make ${v:N:M} more robust for very large M by clamping to MIN/MAX_INT

Before this patch, "${v:2:0x100000001}" = "${v:2:1}",
and similarly, constructs like "${v:2:9999999999}" may give wrong result
due to int overflows.

function                                             old     new   delta
substr_atoi                                            -      43     +43

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c