dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* SEGV parsing of ${#1\x82} and ${#1\x84}
@ 2021-06-19 12:44 Denys Vlasenko
  2021-06-21  9:57 ` [PATCH] parser: Fix VSLENGTH parsing with trailing garbage Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Denys Vlasenko @ 2021-06-19 12:44 UTC (permalink / raw)
  To: Herbert Xu, DASH shell mailing list

Hi,

CTLVAR and CTLBACKQ are not properly handled if encountered
inside {$#...}. Testcase:

dash -c "`printf 'echo ${#1\x82}'`" 00 111 222

It should execute "echo ${#1 <byte 0x82> }" and thus print "3"
(the length of $1, which is "111").

Instead, it segfaults.

(Ideally, it should fail since "1 <byte 0x82>" is not a valid
variable name, but currently dash accepts e.g. "${#1abc}"
as if it is "${#1}bc". A separate, less serious bug...).

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-22  8:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-19 12:44 SEGV parsing of ${#1\x82} and ${#1\x84} Denys Vlasenko
2021-06-21  9:57 ` [PATCH] parser: Fix VSLENGTH parsing with trailing garbage Herbert Xu
2021-06-21 14:21   ` Denys Vlasenko
2021-06-22  0:19     ` Herbert Xu
2021-06-22  8:34       ` Denys Vlasenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).