[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: Re: [PATCH] shell: avoid segfault on ${0::0/0~09J}. Closes 15216
From: Steffen Nurpmeso <steffen () sdaoden ! eu>
Date: 2022-12-29 17:20:08
Message-ID: 20221229172008.iwlL3%steffen () sdaoden ! eu
[Download RAW message or body]
Ron Yorston wrote in
<63ad9a0f.MQrBKX7zM8Pqj639%rmy@pobox.com>:
|Both ash and hush segfault when asked to evaluate ${0::0/0~09J}.
...
| shell/math.c | 3 ++-
...
Without hurry or pressure or any of such sort, but to be more
explicit than in the patch commit message of the thing i had sent,
it must be said that the $(()) evaluator currently in use is
broken in some ways. There are explicitly disabled tests. But
more than what is tested. (And the ?: problem is not easy fixable
with Dijkstra, a recursive descendent thing like bash is however
also not a small solution.)
I am sorry that the one i posted (too often) adds 2000 bytes,
i would have thought it shrinks a bit when fully integrated. All
i could offer for that is to introduce another configuration
switch which disables the very costy and large ?: conditional
branch evaluation, i would assume doing so would bring costs down
by a large amount, while keeping the benefit of the (hopefully)
graceful parser and evaluator. (And ?: is not standardized (yet);
like &&, || etc. etc., but these are all simple binary operators.)
P.S.: the only change since then is that i added some more tests,
maybe grazy stuff
e "<$((0||0||0||0||0||0||0||0||0||0))>"
e "<$((0||0||0||0||0||0||0||0||0||3||0||0))>"
e "<$((0||0||0||0||0||0||0||0||0||3||0&&0))>"
e "<$((0||0||0||0||0||0||0||0||0||3&&0))>"
e "<$(((0||0||0||0||0||0||0||0||0||3||0)&&0))>"
e "<$(((0||0||0||0||0||0||0||0||0||3||0)&&3))>"
s I1 I2 ;p "<$((I1+=I2+=I2))>";e "<$I1><$I2>"
s I1 I2 ;p "<$((I1+=I2+=I1))>";e "<$I1><$I2>"
s I1 I2 ;p "<$((I1+=I2+=I1+=I2))>";e "<$I1><$I2>"
s I1 I2 ;p "<$((I1+=I2+=I1+=I1))>";e "<$I1><$I2>"
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic